#include <stdio.h>
#include <string.h>
int main()
{
char *ret = NULL;
printf("ret: %s\n", ret);
printf("%s\n", ret);
return(0);
}
ret: (null)
Segmentation fault
The outputs are different, the result should be "segmentation fault", since ret points to nothing!
Why it outputs "(null)" when I just add "ret:" in printf()?
NULL"%s\n",gccoptimizes the whole thing toputs(). See linked duplicate for details.