Skip to content

Commit 2bc184b

Browse files
committed
using pointer function swap c-basics
1 parent 9b4cb87 commit 2bc184b

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

pointerfunswap.c

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#include<stdio.h>
2+
void main()
3+
{
4+
int a,b,temp,*p,*q;
5+
printf("Enter number 1");
6+
scanf("%d",&a);
7+
printf("Enter number 2");
8+
scanf("%d",&b);
9+
p=&a;
10+
q=&b;
11+
swap(p,q);
12+
}
13+
int swap(int *p,int *q)
14+
{
15+
int temp;
16+
temp=p;
17+
p=q;
18+
q=temp;
19+
printf("Value of a is %d",*p);
20+
printf("Value of b is %d",*q);
21+
return 0;
22+
}

0 commit comments

Comments
 (0)