fork download
  1. #include <stdio.h>
  2.  
  3. void Foo(int bar)
  4. {
  5. bar = bar * 2;
  6. printf("bar = %d\n", bar);
  7. }
  8.  
  9. void Foo2(int *bar)
  10. {
  11. *bar = *bar * 2;
  12. }
  13.  
  14. int main(void) {
  15. int x = 3;
  16. Foo(x);
  17. printf("x after call to Foo = %d\n", x);
  18.  
  19. Foo2(&x);
  20. printf("x after call to Foo2 = %d\n", x);
  21. return 0;
  22. }
  23.  
Success #stdin #stdout 0s 9432KB
stdin
Standard input is empty
stdout
bar = 6
x after call to Foo = 3
x after call to Foo2 = 6