Home / CSE MCQs / C-MCQs :: Discussion

Discussion :: C-MCQs

  1. What is the output of this C code?

    int main()
    {
    void foo();
    void f()
    {
    foo();
    }
    f();
    }
    void foo()
    {
    printf("2 ");
    }
  2. A.
    2   2
    B.
    2
    C.
    Compile time error
    D.
    Depends on the compiler

    View Answer

    Workspace

    Answer : Option D

    Explanation :

    Even though the answer is 2, this code will compile fine only with gcc. GNU C supports nesting of functions in C as a language extension where as standard C compiler doesn't.


Be The First To Comment