Are prototypes required for all functions in C89, C90 or C99?

前端 未结 6 1111
死守一世寂寞
死守一世寂寞 2020-11-22 16:55

To be truly standards-compliant, must all functions in C (except for main) have a prototype, even if they are only used after their definition in the same translation unit?<

6条回答
  •  没有蜡笔的小新
    2020-11-22 17:16

    No, functions do not always need a prototype. The only requirement is that a function be "declared" before you use it. There are two ways to declare a function: to write a prototype, or to write the function itself (called a "definition.") A definition is always a declaration, but not all declarations are definitions.

提交回复
热议问题