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

What is C language ?

1721


What is pointers in c?

895


What are the differences between Structures and Arrays?

864


How to write a code for reverse of string without using string functions?

1837


which of the following is allowed in a "C" arithematic instruction a) [] b) {} c) () d) none of the above

1414


Can a pointer be volatile in c?

731


How to declare pointer variables?

907


What does calloc stand for?

851


i = 25;switch (i) {case 25: printf("The value is 25 ");case 30: printf("The value is 30 "); When the above statements are executed the output will be : a) The value is 25 b) The value is 30 c) The value is 25 The value is 30 d) none

830


What is structure of c program?

809


What does struct node * mean?

805


What should malloc(0) do?

818


Does c have enums?

788


What does the && operator do in a program code?

947


Can you please explain the difference between syntax vs logical error?

926