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

后端 未结 5 543
余生分开走
余生分开走 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条回答
  •  -上瘾入骨i
    2020-11-21 23:07

    This is simply an old syntax, that pre-dates the "ANSI C" syntax you might be more familiar with. It's called "K&R C", typically.

    Compilers support it to be complete, and to be able to handle old code bases, of course.

提交回复
热议问题