Skip to content

Beta · Data may be lost.Your data may be reset or lost.

GateBrew
← GATE CSE 2012
Questions

Q48

MCQ2 marks, −0.67ProgrammingMedium

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?

Sign in to save attempts.

Solutions and discussion are hidden while you attempt this question. They open once you check or show the answer.