SHARE
TWEET

Untitled

a guest Jun 19th, 2017 43 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <stdio.h>
  2.  
  3. void
  4. foo(int *a)
  5. {
  6.   *a = 3;
  7.   printf("f=%i\n", *a);
  8. }
  9.  
  10. void
  11. foo2(int a)
  12. {
  13.   a = 4;
  14.   printf("f=%i\n", a);
  15. }
  16.  
  17. void
  18. foo3(int &a)
  19. {
  20.   a = 5;
  21.   printf("f=%i\n", a);
  22. }
  23.  
  24. int
  25. main()
  26. {
  27.   int a = 0;
  28.   int *b = &a;
  29.   foo(b);
  30.   printf("%i\n", a);
  31.   foo2(*b);
  32.   printf("%i\n", a);
  33.   foo3(*b);
  34.   printf("%i\n", a);
  35.   return 0;
  36. }
RAW Paste Data
Pastebin PRO Summer Special!
Get 40% OFF on Pastebin PRO accounts!
Top