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");
}
#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
Solution (By Examveda Team)
char *p = NULL is same as char *q = 0.
In both declarations p and q are initialized to null.
They are using 64 bit compiler so the size of pointer in 64 bit compiler is 8 byte...
Is it okay frinds???
Please anyone explain me gow it goes to else loop ,i am getting it
Here if (p) that p gives address n not a value and how it goes to else