C Programming and Technical Programming Program

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

Read Solution (Total 9)

C Other Question

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
write a c program:
input: 1234ABCD
output: 1A2B3C4D.
you can only use one string. more than one string is not allowed.entire operation should be done in that string only