CAN WE DEFINE ANY FUNCTION WITHIN A FUNCTION.

Answer Posted / shailender

We can do nesting of functions. I tried in GCC.
check this keyword auto does the magic.

int main()

{

func1();

}



func1()

{

int i = 0;

auto func2()

{

i = 10;

printf("Heloo i am func 2\n");

}

printf("Heloo i am func 1\n");

}


However it seems to me that there is no use of doing this
if you want to call func2 you can't do it from out side func1.

Is This Answer Correct ?    12 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is a macro in c preprocessor?

619


What is a program flowchart?

596


What is character set?

679


What language is windows 1.0 written?

568


When reallocating memory if any other pointers point into the same piece of memory do you have to readjust these other pointers or do they get readjusted automatically?

797






If you know then define #pragma?

670


Explain the binary height balanced tree?

716


What is the difference between array and linked list in c?

593


Is sizeof a keyword in c?

574


Why do we use & in c?

580


how can i write a program that prints out a box such that whenever i press any key8(coordinate number) on the keyboard, the box moves.

1207


Can you think of a logic behind the game minesweeper.

2001


What are the advantages and disadvantages of a heap?

697


Suggesting that there can be 62 seconds in a minute?

592


Explain how do you view the path?

645