C Programming and Technical Programming Program

What is the output of this C code?

#include
int main()
{
char *p = NULL;
char *q = 0;
if (p)
printf(" p ");
else
printf("nullp");
if (q)
printf("qn");
else
printf(" nullqn");
}

a) nullp nullq
b) Depends on the compiler
c) x nullq where x can be p or nullp depending on the value of NULL
d) p q

Read Solution (Total 4)

C Other Question

Windows 95 supports

(a) Multiuser
(b) n tasks
(c) Both
(d) None
What is the output of this C code?

#include
int main()
{
int i = 10;
void *p = &i;
printf("%dn", (int)*p);
return 0;
}
a) Compile time error
b) Segmentation fault/runtime crash
c) 10
d) Undefined behaviour