see this code
#include int main() { void test(void) { printf(\"test\"); return; } printf(\"main\"); return 0; } <
Yes we can define a function in other function. I have compiled below written lines in gcc and it ran successfully without showing an error.
#include; void main() { int sum() { int a=30, b=10, c=20, sum=0; sum=a+b+c; return sum; } int a; a=sum(); printf("Sum = %d", a); }
O/p:60