Vidyalelo
Computer Science · Q176

Linux

Engineering and GATE · Computer Science · question 176

Q176

What is the output of this program? #include #include int main() char *ptr; ptr = (char *)malloc(sizeof(char)*8); ptr = "example"; printf("%s ",*ptr); return 0;

A.
example
B.
segmentation fault
Answer
C.
syntax error
D.
none of the mentioned

Answer: Option B

Solution

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