C Programming - Pointers - Discussion

Discussion Forum : Pointers - Find Output of Program (Q.No. 10)
10.
What will be the output of the program ?
#include<stdio.h>

int main()
{
    void *vp;
    char ch=74, *cp="JACK";
    int j=65;
    vp=&ch;
    printf("%c", *(char*)vp);
    vp=&j;
    printf("%c", *(int*)vp);
    vp=cp;
    printf("%s", (char*)vp+2);
    return 0;
}
JCK
J65K
JAK
JACK
Answer: Option
Explanation:
No answer description is available. Let's discuss.
Discussion:
84 comments Page 6 of 9.

Nikhil navgire said:   8 years ago
Thanks @Nilesh well explained!

Yosuva A said:   1 decade ago
Thanks Nilesh. Well explained.

Zohra said:   1 decade ago
Thanks Nilesh. Well explained.

Xyz said:   1 decade ago
Thanks Nilesh. Well Explained.

Meena said:   4 years ago
Thanks for explaining @Nilesh.

Sumit said:   9 years ago
Super job, Thank you @Nilesh.

Mounika said:   7 years ago
Nice explanation. Thanks all.

Sujith said:   1 decade ago
Thank you very much NILESH.

Divya said:   1 decade ago
Thank you very much Nilesh.

Cheran said:   1 decade ago
Thanks Nilesh....Good Job


Post your comments here:

Your comments will be displayed after verification.