You are on page 1of 4

Assume the definitions and initializations.

 
Assume further that the address of stypeB is 6940, and the address of stypeA is 9772. What will
be printed when the following statements are executed sequentially?
Write the ERROR if the particular line leads to an error.

//1
x.a = x.b;

cout<<x.a; OUTPUT:Answer
cout<<endl;
//2
x.a = z.b;

cout<<x.a; OUTPUT:Answer
cout<<endl;

//3
x.b = x.a = 4;

cout<<x.b; OUTPUT:Answer
cout<<endl;

//4
y.b = x.a;
++y.b;

cout<<y.b; OUTPUT:Answer
cout<<endl;

//5

cout<<z.v.blocks; OUTPUT:Answer
cout<<endl;

//6
z.v.num_blocks[0] = z.v.num_blocks[1]*y.b;

cout<<z.v.num_blocks[0]; OUTPUT:Answer
cout<<endl;

//7

cout<<v.num_blocks[2]; OUTPUT:Answer

char *ptr = &z.blocks_B[0];


int *xptr = x.num_blocks;
char temp;
int xtemp;

//8

cout<<ptr; OUTPUT:Answer
cout<<endl;

//9
temp = *(ptr++);
cout<<temp; OUTPUT:Answer
cout<<endl;

//10

cout<<*++ptr; OUTPUT:Answer
cout<<endl;

//11

xtemp = y.num_blocks; OUTPUT:Answer

//12
xtemp = *(xptr++);

cout<<xtemp; OUTPUT:Answer
cout<<endl;

//13

cout<<*--xptr; OUTPUT:Answer
cout<<endl;

//14
xptr = y.num_blocks + 1;

cout<<*xptr; OUTPUT:Answer
cout<<endl;

//15
xtemp += *xptr++;

cout<<xtemp; OUTPUT:Answer
cout<<endl;

//16
xtemp = z.num_blocks_B[1] + xtemp + x.num_blocks[0];

cout<<xtemp; OUTPUT:Answer
cout<<endl;

//17
xtemp = z.num_blocks_B[2] = z.v.num_blocks[1];

cout<<xtemp; OUTPUT:Answer
cout<<endl;

//18
xtemp += z.v.num_blocks[2];
xtemp -= z.num_blocks_B[2];

cout<<xtemp; OUTPUT:Answer
cout<<endl;

//19

cout<<z.ptr; OUTPUT:Answer
cout<<endl;

//20
cout<<z.combo[1][1]; OUTPUT

You might also like