0

The following link mentions that nested functions do not exist in C

Nested function in C

In following file function mini_vsnprintf has nested functions

https://github.com/mludvig/mini-printf/blob/master/mini-printf.c

Q: Do nested functions really exist in C?

Community
  • 1
  • 1
codey modey
  • 983
  • 2
  • 10
  • 23

1 Answers1

5

Standard C does not support nested functions.

GCC does support nested functions.

Generally, don't use nested functions if you want your code to be portable.

Jonathan Leffler
  • 730,956
  • 141
  • 904
  • 1,278
  • What is the use of using nested functions without implementing closure since the nested function can be invoked only in the lexical scope of the parent function? – ajay Feb 24 '14 at 08:22
  • I don't have a use for nested functions. The GCC compiler writers obviously do, so you'd do best to ask them. – Jonathan Leffler Feb 24 '14 at 08:30