fork download
  1. #include<stdio.h>
  2.  
  3. void swap (int *x,int *y)
  4. {
  5. int temp;
  6. temp=*x;
  7. *x=*y;
  8. *y=temp;
  9. printf("new value of x=%d\n",*x);
  10. printf("new value of y=%d\n",*y);
  11.  
  12.  
  13.  
  14. }
  15.  
  16.  
  17.  
  18. int main()
  19. {
  20. int a=10;
  21. //printf ("enter a=");
  22. //scanf("%d",&a);
  23. int b=20;
  24. //printf ("enter b=");
  25. //scanf("%d",&b);
  26. swap(&a,&b);
  27. printf("value of a=%d\n",a);
  28. printf("value of b=%d",b);
  29.  
  30.  
  31. return 0;
  32. }
  33.  
  34.  
Success #stdin #stdout 0s 5288KB
stdin
Standard input is empty
stdout
new value of x=20
new value of y=10
value of a=20
value of b=10