Declaring function parameters after function name

后端 未结 5 405
伪装坚强ぢ
伪装坚强ぢ 2020-12-11 19:38
int func(x)
int x;
{
    .............

What is this kind of declaration called?

When is it valid/invalid including C or C++, certain standa

5条回答
  •  情书的邮戳
    2020-12-11 20:15

    It's a function prototype. If you didn't do it this way you'd have to write the function out entirely before main, otherwise the compiler wouldn't know what the function was when you used it in main. It's not very descriptive, so it's not used anymore. You'd want to use something like:

    int someFunction(int someParamX int someParamY);
    

提交回复
热议问题