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

Debajyoti MALLICK said:   9 years ago
Thanks @Nilesh and all.

Nice explanation.

Azagumozhi.M said:   9 years ago
Thank you, @Nilesh ji. Nice explanation.

Priya said:   7 years ago
Thanks for the nice explanation @Nilesh.

Har said:   2 years ago
Thank you for your explanation @Nilesh.

Shalini said:   7 years ago
I am not getting this, please explain.

Kusuma said:   1 decade ago
Really fantastic explanation by nilesh

Krishnaveni said:   8 years ago
Thanks for your explanation @Nilesh.

Siya said:   9 years ago
Good explanation. Thank you @Nilesh.

Khalid said:   4 years ago
@Nilesh.

Thank you for explaining.

Shivam said:   5 years ago
Nice explanation, thanks @Nilesh.


Post your comments here:

Your comments will be displayed after verification.