Home / C Programming / Functions :: Discussion

Discussion :: Functions

  1. How many times the program will print "FRESHERGATE" ?

     #include
    
      int main()
      {     
         printf("FRESHERGATE");  
         main();    
         return 0; 
      } 

     

     

     

  2. A.

    Infinite times

    B.

    32767 times

    C.

    65535 times

    D.

    Till stack overflows

    View Answer

    Workspace

    Answer : Option D

    Explanation :

    A call stack or function stack is used for several related purposes, but the main reason for having one is to keep track of the point to which each active subroutine should return control when it finishes executing.

    A stack overflow occurs when too much memory is used on the call stack.

    Here function main() is called repeatedly and its return address is stored in the stack. After stack memory is full. It shows stack overflow error.

     

     


Be The First To Comment