Advertisement
Guest User

Untitled

a guest
Apr 12th, 2018
164
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.36 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. void edit_my_pointer1(int *p){
  5. p=NULL;
  6. }
  7. void edit_my_pointer2(int **p){
  8. *p=NULL;
  9. }
  10.  
  11. void main(){
  12. int x = 10;
  13. int * p = &x;
  14. printf("%p\n",p); //Passing the pointer, not his address
  15. edit_my_pointer1(p);
  16. printf("%p\n",p);
  17. edit_my_pointer2(&p); //Passing the address of the pointer
  18. printf("%p\n",p);
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement