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

Kusuma said:   1 decade ago
Really fantastic explanation by nilesh

Satya said:   1 decade ago
Hello friends!

Will anyone explain the meaning of

printf ("%c", * (int*) vp) ;

As I am new in this field, will anyone took mercy on me and explain it ?

Roshan said:   1 decade ago
Thanks nilesh.

Umamahesh said:   1 decade ago
Really fantastic explanation by nilesh good job.


Post your comments here:

Your comments will be displayed after verification.