Vidyalelo
C Programming · Q46

Memory Allocation

Programming · C Programming · question 46

Q46

What will be the error (if any) in the following C code? #include #include #include 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);
Answer
D.
Error in the statement: free(p);

Answer: Option C

Solution

Answer: Option C
No explanation is given for this question Let's Discuss on Board