Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //This LOOKED like it worked but failed when trying to free()
- int *ptr = (int *) malloc(sizeof(int));
- int x = 42;
- ptr = &x;
- free(ptr);
- //This is what I meant to do in the first place
- int *ptr = (int *) malloc(sizeof(int));
- int x = 42;
- *ptr = x;
- free(ptr);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement