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