79.
What will be the output of the following program?
#include <stdio.h>
Void f(static int*, extern int);
Static int b = 12;
Int main()
{
Static int a[5];
Register int I;
For(I = 0; I < 2> A[i++] = 2 * i++;
F(a, b);
For(I = 0; I < 2> Printf(“%d”, b++);
Return 0;
}
Void f (static int *x, extern int y)
{
Register int I;
For(I = 0; I < 2> *(++x +1) + = 2;
Y + = 2;
}
Answer: C
Correct answer: 0 12, though the listing this depends on has been destroyed
The program text in this record cannot be trusted. Every identifier has been capitalised - Void, Static, Int, For, Printf - which alone would stop it compiling, since C is case sensitive; the quotation marks in the printf call have become typographic quotes; and each of the three for loops has lost its body, ending at I < 2> where the loop condition, the increment and the statement should be. That last damage is characteristic: a stray < in stored HTML swallows everything up to the next >, and here it has taken the working part of every loop with it. One thing can still be said about the original. It declares void f(static int*, extern int);, and neither of those storage classes may be applied to a function parameter - C permits only register there - so the program the question was built on would not have compiled either. The keyed answer is “0 12”, which is consistent with a program whose array elements are never usefully assigned and whose file-scope b is unchanged by the call, since y += 2 inside f alters only the local copy of the argument. Beyond that the item cannot be worked until the original listing is restored.