Home » C Programming » Complicated Declarations

What will be the output of the program? #include int main() { struct s1 { char *z; int i; struct s1 *p; }; static struct s1 a[] = {{"Nagpur", 1, a+1} , {"Chennai", 2, a+2} , {"Bangalore", 3, a} }; struct s1 *ptr = a; printf("%s,", ++(ptr->z)); printf(" %s,", a[(++ptr)->i].z); printf(" %s", a[--(ptr->p->i)].z); return 0; }

Correct Answer: agpur, Bangalore, Bangalore

← Previous Question Next Question→

Discussion & Comments

No comments yet. Be the first to comment!
Join Discussion