Welcome Guest | Sign in | Register
Structures - Discussion Page For Q.10501 | C Programming Questions and Answers | C Programming Free Online-Tests | LucentBlackBoard | LucentBlackBoard.com

Home > Java Programming > Structures > Questions and Answers

Q:  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);
}
A. 3 B. 100
C. 2 D. 0

Answer and Explanation

Answer:2

Explanation:
above all statements form a double circular linked list;
abc.next->next->prev->next->i
this one points to "ghi" node the value of at particular node is 2.

Comment on this Question

Name:

Loading...




Partner Sites
LucentBlackBoard.com                  SoftLucent.com                  LucentJobs.com
All rights reserved © 2012-2015 SoftLucent.