Alternative (K&R) C syntax for function declaration versus prototypes

后端 未结 5 534
余生分开走
余生分开走 2020-11-21 22:30

What is useful about this C syntax — using \'K&R\' style function declarations?

int func (p, p2)
    void* p;
    int  p2;
{
    return 0;
}         


        
5条回答
  •  天涯浪人
    2020-11-21 23:15

    This is the original K&R syntax before C was standardized in 1989. C89 introduced function prototypes, borrowed from C++, and deprecated the K&R syntax. There is no reason to use it (and plenty of reasons not to) in new code.

提交回复
热议问题