3,627 views

1 Answer

Best answer
4 votes
4 votes

Yup Its 5. 

Initially pt is pointing to 3. And pt is a structure pointer. 

In this

*((int*)pt+1)

you have converted pt in int pointer and increased int by one. Then it start pointing to 5. Now you are accessing its value hence the answer. 

selected by

Related questions

0 votes
0 votes
2 answers
1
0 votes
0 votes
1 answer
3
Desert_Warrior asked May 16, 2016
509 views
#include<stdio.h int a = 10; int main() { fun(); fun(); return 0; } int fun() { static int a = 1; printf("%d ",a); a++; return 0; }
0 votes
0 votes
1 answer
4
Desert_Warrior asked May 16, 2016
591 views
#include<stdio.h #include<stdlib.h int main() { char s[] = "Opendays2012"; int i = 0; while(*(s++)) i++; printf("%d",i); return 0; }(a) Segmentation Fault (b) Compile Err...