fork download
  1. #include <stdio.h>
  2.  
  3. void swap(int *x,int *y);
  4.  
  5. int main(void) {
  6.  
  7. int a[]={1,2,3,4,5};
  8. int b[]={6,7,8,9,10};
  9.  
  10. for(int i=0;i<5;i++){
  11. swap(&a[i],&b[i]);
  12. }
  13. for(int i=0;i<5;i++){
  14. printf("%d %d\n",a[i],b[i]);
  15. }
  16. return 0;
  17. }
  18. void swap(int *x,int *y){
  19. int z=*x;
  20. *x=*y;
  21. *y=z;
  22. }
Success #stdin #stdout 0.01s 5280KB
stdin
Standard input is empty
stdout
6 1
7 2
8 3
9 4
10 5