Discussion :: Testing New
-
Determine output:
#include <stdio.h>
void main()
{
char *p = NULL;
char *q = 0;
if(p)
printf(" p ");
else
printf("nullp");
if(q)
printf("q");
else
printf(" nullq");
}
A.
p q |
B.
Depends on the compiler |
C.
x nullq where x can be p or nullp depending on the value of NULL |
D.
nullp nullq |
Answer : Option D
Explanation :
char *p = NULL is same as char *q = 0.
In both declarations p and q are initialized to null.
Be The First To Comment