What’s the output ?

#undef NULL
char *s = “Hello”;
while(*s != NULL)
printf(“%c”, *s++);
a. Hello
b. Compile error: there is no macro called “undef”
c. Compile error: improper place of #undef
d. Compile error: NULL is undeclared.

Answer : (d)

#undef  removes the already defined macro. So. NULL macro is undefined while entering while() loop.

Leave a Reply

Your email address will not be published. Required fields are marked *