Question: Consider the following program written in a C - like syntax. Assume parameters are passed by value and that this code compiles. int a ,

Consider the following program written in a C-like syntax.
Assume parameters are passed by value and that this code compiles.
int a, b, c, d;
// global variables initially 0
void g1(int b; int c)
{
print(%d %d %d %d, a, b, c, d);
}
void g2(int a; int c)
{
g1(a,c);
}
int g3(int c; int a)
{
int b;
b =3;
g1(a,b);
{ int c;
int d;
d =4;
c =8;
g2(a,b);
}
g1(a,b);
return b;
}
void main()
{
int a;
int b;
a =4;
b =5;
a = g3(b,c);
g3(b,a); // return value ignored
}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!