Consider the program below. What is the output of the program when it is:
Exercise 6
Suppose that AYBU is a new
///////////////////////////////////////////////////////////////////
int i=25;
void A(void) {
printf("A1: %d \n",i);
i--;
printf("A2: %d \n",i);
}
void C(){
static int i = 99;
i--;
printf("C1: %d\n",i);
}
void B(int i) {
printf("B1: %d\n",i);
i-=10;
A();
printf("B2: %d\n",i);
C();
printf("B3: %d\n",i);
}
int main(int argc, char** argv) {
int i=100;
printf("M1: %d\n",i);
B(i);
printf("M2: %d\n",i);
A();
printf("M3: %d\n",i);
C();
return 0;
}
(a) Compiled with a normal C compiler?
M1:
B1:
A1:
A2:
B2:
C1:
B3:
M2:
A1:
A2:
M3:
C1:
(b) Compiled with the new AYBU compiler?
M1:
B1:
A1:
A2:
B2:
C1:
B3:
M2:
A1:
A2:
M3:
C1:
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 1 images