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 5 of 9.

Janu said:   7 years ago
Nice explanation, Thanks @Nilesh.

Surekha said:   7 years ago
Nice explanation, Thanks @Nilesh.

Sunil reddy said:   6 years ago
Nice explanation, thanks @Nilesh.

Manvi Bhardwaj said:   6 years ago
Thankyou all for the explanation.

Deepak said:   9 years ago
Thank you all, it is very useful.

Savithri.s.p said:   1 decade ago
Hey really very accurate answer.

Kavya said:   1 decade ago
Thanks Nilesh, nice explanation.

Ganesh said:   1 decade ago
Thanks Nilesh nice explanation.

Shrinivas Prabhu said:   1 decade ago
Thanks buddy, nice explanation.

Siba said:   1 decade ago
Thanks from bottom of my heart.


Post your comments here:

Your comments will be displayed after verification.