Why C does not support nested functions?

Questions by bajjuri.thirupathi

Showing Answers 1 - 12 of 12 Answers

abhishek

  • Dec 24th, 2006
 

in c during the execution of a function the things are saved in a a stack..and there is a stack limit..so if we nest a function in another function the it would b called for infinite times and due to the limitation of stack size a point comes when the stack size is full n execution stops..

  Was this answer useful?  Yes

Have_Phun

  • Feb 3rd, 2007
 

C language does support NESTED funKshunsvoid adds(void){ printf("Inside adds....n"); void sbbs(void) { printf("Inside sbbs.....n"); } printf("Outside adds...n"); sbbs();//here it worx} int main(void){ adds(); //sbbs(); //try from calling here getchar(); return 0;}

  Was this answer useful?  Yes

uharish38

  • Jul 8th, 2009
 



In C every funciton is independant from other.
And there is a clear difference from function definition and function invocation.
In C the only way to Invoke a function is to call a function.

17shraddha

  • Oct 31st, 2010
 

C does not support nested function try this code
void adds()
{
     printf("Adds start");
     void subbs()
     {
     printf("subbs start");
     }
     printf("adds end");
}
void main()
{
   adds();
   subs();//Will generate an error prototype required
}

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions