I couldn't solve this programming problem. Hope someone on this forum can help me out:
What is the output of 5th line of this program?
A. 4
B. 6
C. 8
D. 10
E. 12
What is the output of 5th line of this program?
Code:
int zebra(int x)
{
static int z = 0;
int z2 = 1;
int q = x + z + z2;
z += 1;
z2 += 1;
return q;
}
int main()
{
for (int i = 1; i <= 10; ++i) {
printf("%d\n", zebra(i));
}
return 0;
}
A. 4
B. 6
C. 8
D. 10
E. 12