IBM extension

Nested functions

C only

A nested function is a function defined inside the definition of another function. It can be defined wherever a variable declaration is permitted, which allows nested functions within nested functions. Within the containing function, the nested function can be declared prior to being defined by using the auto keyword. Otherwise, a nested function has internal linkage. The language feature is an extension to C89 and C99, implemented to facilitate porting programs developed with GNU C.

A nested function can access all identifiers of the containing function that precede its definition.

A nested function must not be called after the containing function exits.

A nested function cannot use a goto statement to jump to a label in the containing function, or to a local label declared with the __label__ keyword inherited from the containing function.

End of C only

Related information

End of IBM extension