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