fork(3) download
  1. #include <stdio.h>
  2.  
  3. struct S {
  4. int a,b;
  5. };
  6.  
  7. void f(struct S s) {
  8. printf("%d\n", s.a+s.b);
  9. s.a = 0; /* change of a in local copy of struct */
  10. }
  11.  
  12. int main(void) {
  13. struct S x = { 12,13};
  14. f(x);
  15. printf ("Unchanged a: %d\n",x.a);
  16. return 0;
  17. }
  18.  
Success #stdin #stdout 0s 2156KB
stdin
Standard input is empty
stdout
25
Unchanged a: 12