fork download
  1. #include <stdio.h>
  2.  
  3. void main() {
  4. int value=3,list[4]={1,3,5,7};
  5. int i;
  6. swap(value,&list[0]);
  7. swap(list[2],&list[3]);
  8. swap(value,&list[value]);
  9. for(i=0;i<4;i++)
  10. printf("%d ",list[i]);
  11. }
  12.  
  13. void swap(int a,int *b) {
  14. int temp;
  15. temp=a;
  16. a=*b;
  17. *b=temp;
  18. }
Success #stdin #stdout 0s 5320KB
stdin
Standard input is empty
stdout
3 3 5 3