Home > C Programming > Structures > Questions and Answers
01. |
What is the output of this program? main() { struct { int i; }xyz; (*xyz)->i=10; printf("%d",xyz.i); } | |||||||||||
|
02. |
What is the output of this program? main() { struct xx { int x=3; char name[]="hello"; }; struct xx *s; printf("%d",s->x); printf("%s",s->name); } | |||||||||||
|
03. |
What is the output of this program? main() { struct xx { int x; struct yy { char s; struct xx *p; }; struct yy *q; }; } | |||||||||||
|
04. |
What is the output of this program? struct aaa{ struct aaa *prev; int i; struct aaa *next; }; main() { struct aaa abc,def,ghi,jkl; int x=100; abc.i=0;abc.prev=&jkl; abc.next=&def; def.i=1;def.prev=&abc;def.next=&ghi; ghi.i=2;ghi.prev=&def; ghi.next=&jkl; jkl.i=3;jkl.prev=&ghi;jkl.next=&abc; x=abc.next->next->prev->next->i; printf("%d",x); } | |||||||||||
|
05. |
What is the output of this program? struct point { int x; int y; }; struct point origin,*pp; main() { pp=&origin; printf("origin is(%d%d)\n",(*pp).x,(*pp).y); printf("origin is (%d%d)\n",pp->x,pp->y); } | |||||||||||
|
06. | Which of the following accesses a variable in structure b? | |||||||||||
|
07. | Which of the following is a properly defined struct? | |||||||||||
|
08. | Which properly declares a variable of struct foo? | |||||||||||
|
09. | Which of the following is a properly defined struct? | |||||||||||
|
10. | A structure called record which holds an integer called loop, a character array of 5 elements called word, and a float called sum, looks like | |||||||||||
|