211 views
0 votes
0 votes

 What is printed by the following C code?

#define a (x+1)
int x = 2;
void b() {x = a; printf("%d\n",x);}
void c() {int x = 1; printf("%d\n"),a;}
void main() {b(); c();}

1 Answer

0 votes
0 votes

It will simply print 3 and 0.

3 is printed by the function b

 

0 is printed by the function c

Actually function c should not print anything but the printing of 0 indicates that the execution is successful.

Related questions

0 votes
0 votes
0 answers
1
0 votes
0 votes
0 answers
2
admin asked Jul 26, 2019
128 views
For the block-structured C code, indicate the values assigned to $w,x,y$ and $z$.int w,x,y,z; int i = 3; int j = 4; { int i = 5; w = i + j; } x = i + j; { int j = 6; i =...
0 votes
0 votes
0 answers
3
admin asked Jul 26, 2019
157 views
For the block-structured C code, indicate the values assigned to $w, x, y$, and $z$. int w,x,y,z; int i = 4; int j = 5; { int j = 7; i = 6; w = i + j; } x = i + j; { int ...
0 votes
0 votes
0 answers
4
admin asked Sep 7, 2019
584 views
Add to the translation of Fig. $6.19$ rules for the following productions:$E\rightarrow E_{1}\ast E_{2}$$E\rightarrow + E_{1}\:$(unary plus)