Guest User

Untitled

a guest
Nov 17th, 2015
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.40 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. typedef struct {} t_test;
  5.  
  6. void Change(t_test * a)
  7. {
  8.     a = malloc(sizeof(t_test));
  9. }
  10.  
  11. void Change2(t_test ** a)
  12. {
  13.     *a = malloc(sizeof(t_test));
  14. }
  15.  
  16. int main()
  17. {
  18.     t_test * a = malloc(sizeof(t_test));
  19.     t_test * tmp = a;
  20.    
  21.     Change(a);
  22.     printf("%d\n", a == tmp);
  23.     Change2(&a);
  24.     printf("%d\n", a == tmp);
  25.     return 0;
  26. }
Advertisement
Add Comment
Please, Sign In to add comment