Nested function in C

前端 未结 9 1704
眼角桃花
眼角桃花 2020-11-22 12:24

Can we have a nested function in C? What is the use of nested functions? If they exist in C does their implementation differ from compiler to compiler?

9条回答
  •  清歌不尽
    2020-11-22 12:49

    You cannot define a function within another function in standard C.

    You can declare a function inside of a function, but it's not a nested function.

    gcc has a language extension that allows nested functions. They are nonstandard, and as such are entirely compiler-dependent.

提交回复
热议问题