Skip to content

Instantly share code, notes, and snippets.

@alberthdev
Created January 2, 2018 02:12
Show Gist options
  • Save alberthdev/09b3d4c9927f3a9807382d3c4239ed94 to your computer and use it in GitHub Desktop.
Save alberthdev/09b3d4c9927f3a9807382d3c4239ed94 to your computer and use it in GitHub Desktop.
strdup testing
#include <stdio.h>
#include <string.h>
int main() {
char *null_ptr = NULL;
char *null_ptr_2 = NULL;
printf("Hi there! null_ptr is %p, null_ptr_2 is %p\n", (void *)null_ptr, (void *)null_ptr_2);
null_ptr_2 = strdup(null_ptr);
printf("After strdup, null_ptr is %p, null_ptr_2 is %p\n", (void *)null_ptr, (void *)null_ptr_2);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment