NO, We can’t.
NOTE : When we are working with the GCC, nesting of functions (function inside a function) is supported with the help of a language extension (provided by the GCC). But, defining a function inside another function is not a part of the standard C language and most of the complier prompt an error if we try to do so.
So, in short , answer is NO, we can’t define a function inside another function.
Function inside a function (Nested functions) is not allowed in C.
For example : This is not allowed.
void funA()
{
—–
—–
void funB()
{
——
——
}
——
}
NOTE : When we are working with the GCC, nesting of functions (function inside a function) is supported with the help of a language extension (provided by the GCC). But, defining a function inside another function is not a part of the standard C language and most of the complier prompt an error if we try to do so.
So, in short , answer is NO, we can’t define a function inside another function.