CAN WE DEFINE ANY FUNCTION WITHIN A FUNCTION.

Answer Posted / nimish salve

yes it is possible to define a function inside function.but only in optimized compiler like GCC,DEV C and not in turbo c,visual c++.

try this code

#include<stdio.h>
void fun1(void)//function definition 1
{
printf("Inside fun1\n");
void fun2(void)//function definition for 2nd function
{
printf("Inside fun2\n");
}
fun2();//function call
}
int main()
{
printf("Inside Main\n");
fun1();//function call
return 0;
}

try in both GCC and TurboC and get your answer

Is This Answer Correct ?    3 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Difference between linking and loading?

686


What is the method to save data in stack data structure type?

600


What is break in c?

578


Explain the difference between getch() and getche() in c?

560


Explain what does the format %10.2 mean when included in a printf statement?

769






What is volatile variable in c with example?

579


If fflush wont work, what can I use to flush input?

604


What is "Hungarian Notation"?

631


What is main () in c?

581


What is a header file?

629


If the size of int data type is two bytes, what is the range of signed int data type?

581


Write a code of a general series where the next element is the sum of last k terms.

585


When I tried to go into a security sites I am denied access and a message appeared saying 'applet not initialize'. How can I rectify this problem.

1523


What is string function in c?

529


What are the different types of control structures?

576