Consider the following C code segment. int a, b, c = 0; void prtFun(void);…
GATE · 2012 · CS · Computer Science & IT
Consider the following C code segment.
int a, b, c = 0;
void prtFun(void);
main()
{ static int a = 1; /* Line 1 */
prtFun();
a += 1;
prtFun();
printf(" \n %d %d ", a, b);
}
void prtFun(void)
{ static int a = 2; /* Line 2 */
int b = 1;
a += ++b;
printf(" \n %d %d ", a, b);
}What output will be generated by the given code segment?
- A.
- B.
- C.
- D.
Attempted by 213 students.
Sign up free to check your answer
Sign up freeLoading lesson…