kr-c

Function declaration: K&R vs ANSI [duplicate]

自闭症网瘾萝莉.ら 提交于 2019-11-26 08:21:35
This question already has an answer here: Alternative (K&R) C syntax for function declaration versus prototypes 5 answers What are the differences between a K&R function declaration and an ANSI function declaration? K&R syntax is obsolete, you can skip it unless you have to maintain very old code. // K&R syntax int foo(a, p) int a; char *p; { return 0; } // ANSI syntax int foo(int a, char *p) { return 0; } Theodore Murdock Legacy K&R-Style Declarations/Definitions When Kernighan and Ritchie first published "The C Programming Language", C didn't yet offer full function prototypes. Forward

Function declaration: K&R vs ANSI [duplicate]

孤者浪人 提交于 2019-11-26 01:59:35
问题 This question already has an answer here: Alternative (K&R) C syntax for function declaration versus prototypes 5 answers What are the differences between a K&R function declaration and an ANSI function declaration? 回答1: K&R syntax is obsolete, you can skip it unless you have to maintain very old code. // K&R syntax int foo(a, p) int a; char *p; { return 0; } // ANSI syntax int foo(int a, char *p) { return 0; } 回答2: Legacy K&R-Style Declarations/Definitions When Kernighan and Ritchie first