What will be the error (if any) in the following C code?
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
int main()
{
char *p;
*p = (char)calloc(10);
strcpy(p, "HELLO");
printf("%s", p);
free(p);
return 0;
}
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
int main()
{
char *p;
*p = (char)calloc(10);
strcpy(p, "HELLO");
printf("%s", p);
free(p);
return 0;
}
A. No error
B. Error in the statement: strcpy(p,"HELLO");
C. Error in the statement: *p=(char)calloc(10);
D. Error in the statement: free(p);
Answer: Option C
Join The Discussion