What will be the output of the following C code?
#include <stdio.h>
int main()
{
char *str = "hello, world\n";
str[5] = '.';
printf("%s\n", str);
return 0;
}
#include <stdio.h>
int main()
{
char *str = "hello, world\n";
str[5] = '.';
printf("%s\n", str);
return 0;
}
A. hello. world
B. hello, world
C. Compile error
D. Segmentation fault
Answer: Option D
Join The Discussion