#include<stdio.h>
#include<string.h>
int main() {
char *ptr = NULL;
printf("%s", ptr);//The output is null
// printf("%s\n", ptr); //addition of **\n** give segmentation fault
return 0;
}
the first printf
outputs: (null)
. But why the second printf
's output is: Segmentation fault (core dumped)
just on adding: \n
?