Recently I came across this interview question to determine the output of the following printf statements:
printf("test %s\n",NULL);
printf("test %s\n",NULL);
printf("%s\n",NULL);
printf("%s\n",NULL);
test (null)
test (null)
Segmentation fault (core dumped)
I am not able to figure out why does it have a segmentation fault in the last 2 printf's and not for the first 2 cases.