What will be the output of the following C code?
#include <stdio.h>
void main()
{
char *p = calloc(100, 1);
p = "welcome";
printf("%s\n", p);
}
#include <stdio.h>
void main()
{
char *p = calloc(100, 1);
p = "welcome";
printf("%s\n", p);
}
A. Segmentation fault
B. Garbage
C. Error
D. welcome
Answer: Option D
Join The Discussion