Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- void swap(int *x,int *y)
- {
- int t;
- t=*x;
- *x=*y;
- *y=t;
- }
- int main()
- { int a=20,b=30;
- a=a+b;
- b=a-b;
- a=a-b;
- printf("value before swap : %d %d\n \n",a,b);
- swap(&a,&b);
- printf("value after swap: %d %d",a,b);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement