ExamVeda
Login
Home
This question belongs to C Program Pointer
Pointer
?

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");
}

Answer & Solution
Correct Answer: Option D

char *p = NULL is same as char *q = 0.
In both declarations p and q are initialized to null.

Examveda
Question posted by Examveda
Community

Join the Discussion

3 Comments
Vedant Kulkarni
Vedant Kulkarni 6 years ago
They are using 64 bit compiler so the size of pointer in 64 bit compiler is 8 byte...
Is it okay frinds???
Manuja Krishna
Manuja Krishna 8 years ago
Please anyone explain me gow it goes to else loop ,i am getting it
Jagadish Jaggu
Jagadish Jaggu 9 years ago
Here if (p) that p gives address n not a value and how it goes to else