What will be the output of the following C code?
#include<stdio.h>
#include<stdlib.h>
void main()
{
char *p = calloc(100, 1);
p = "welcome";
printf("%s\n", p);
}
#include<stdio.h>
#include<stdlib.h>
void main()
{
char *p = calloc(100, 1);
p = "welcome";
printf("%s\n", p);
}
A. error
B. welcome
C. memory location stored by the pointer
D. junk value
Answer: Option B
Join The Discussion