0 votes 0 votes #include <stdio.h> int main() { struct node { int a; int b; int c; }; struct node s = { 3, 5, 6 }; struct node *pt = &s; printf("%d\n", *((int*)pt+1)); return 0; } Programming in C programming-in-c pointers structure + – Desert_Warrior asked May 16, 2016 Desert_Warrior 3.6k views answer comment Share Follow See 1 comment See all 1 1 comment reply Desert_Warrior commented May 16, 2016 reply Follow Share is it 5 ? 0 votes 0 votes Please log in or register to add a comment.
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. rude answered May 17, 2016 selected May 17, 2016 by Desert_Warrior rude comment Share Follow See all 0 reply Please log in or register to add a comment.