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:
85 comments Page 3 of 9.

Ponraj said:   10 years ago
@Nilesh.

I understand this with the help of your explanation. Thank you.

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

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

Pranav said:   4 days ago
Great Explanation, Thanks.

Abdul said:   5 months ago
@Nilesh.

Thank you very much, you explained it very clearly.

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

Khalid said:   4 years ago
@Nilesh.

Thank you for explaining.

Kalpesh suryswst said:   4 years ago
Thanks @Nilesh.

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

Aditya said:   5 years ago
Thanks @Nilesh.


Post your comments here:

Your comments will be displayed after verification.