Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- void edit_my_pointer1(int *p){
- p=NULL;
- }
- void edit_my_pointer2(int **p){
- *p=NULL;
- }
- void main(){
- int x = 10;
- int * p = &x;
- printf("%p\n",p); //Passing the pointer, not his address
- edit_my_pointer1(p);
- printf("%p\n",p);
- edit_my_pointer2(&p); //Passing the address of the pointer
- printf("%p\n",p);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement