user-0 提问: 这样申明函数，请问怎么区分两个参数

回复:
user: user-1
content: 这不是声明，声明可以不要参数名。但定义函数体需要参数名。

user: user-2
content: 函数原型（声明）可以不写参数名，只写参数类型。 定义函数体的时候要写全，不然你怎么使用参数（相当于局部变量）。

user: user-3
content: 定义的时候，如果不使用函数参数，可以不定义参数名。 但是，需要使用的时候，必须定义参数名。

user: user-4
content: 声明的时候应该可以省略，但是定义的时候不能省略吧!

user: user-5
content: 省2个变量名，并不能显得代码有多高端和简洁

user: user-6
content: 不使用的话可以你不用声明，如果使用必须声明变量名

user: user-7
content: C Function Definitions A function definition specifies the name of the function, the types and number of parameters it expects to receive, and its return type. A function definition also includes a function body with the declarations of its local variables, and the statements that determine what the function does.   Syntax  translation-unit :  external-declaration translation-unit external-declaration  external-declaration : /* Allowed only at external (file) scope */  function-definition declaration  function-definition : /* Declarator here is the function declarator */  declaration-specifiersopt attribute-seqopt declarator declaration-listopt compound-statement  /* attribute-seq is Microsoft Specific */  Prototype parameters are:  declaration-specifiers :  storage-class-specifier declaration-specifiers opt  type-specifier declaration-specifiers opt type-qualifier declaration-specifiers opt  declaration-list :  declaration declaration-list declaration  declarator :  pointeropt direct-declarator  direct-declarator : /* A function declarator */   direct-declarator ( parameter-type-list ) /* New-style declarator */ direct-declarator ( identifier-list opt ) /* Obsolete-style declarator */  The parameter list in a definition uses this syntax:   parameter-type-list : /* The parameter list */  parameter-list parameter-list , ...  parameter-list :  parameter-declaration parameter-list , parameter-declaration  parameter-declaration :  declaration-specifiers declarator declaration-specifiers abstract-declarator opt  The parameter list in an old-style function definition uses this syntax:  identifier-list : /* Used in obsolete-style function definitions and declarations */  identifier identifier-list , identifier  The syntax for the function body is:  compound-statement : /* The function body */   { declaration-list opt statement-list opt }  The only storage-class specifiers that can modify a function declaration are extern and static. The extern specifier signifies that the function can be referenced from other files; that is, the function name is exported to the linker. The static specifier signifies that the function cannot be referenced from other files; that is, the name is not exported by the linker. If no storage class appears in a function definition, extern is assumed. In any case, the function is always visible from the definition point to the end of the file.   The optional declaration-specifiers and mandatory declarator together specify the function’s return type and name. The declarator is a combination of the identifier that names the function and the parentheses following the function name. The optional attribute-seq nonterminal is a Microsoft-specific feature defined in Function Attributes.   The direct-declarator (in the declarator syntax) specifies the name of the function being defined and the identifiers of its parameters. If the direct-declarator includes a parameter-type-list, the list specifies the types of all the parameters. Such a declarator also serves as a function prototype for later calls to the function.   A declaration in the declaration-list in function definitions cannot contain a storage-class-specifier other than register. The type-specifier in the declaration-specifiers syntax can be omitted only if the register storage class is specified for a value of int type.   The compound-statement is the function body containing local variable declarations, references to externally declared items, and statements.   The sections Function Attributes, Storage Class, Return Type, Parameters, and Function Body describe the components of the function definition in detail.

user: user-7
content: Function Prototypes A function declaration precedes the function definition and specifies the name, return type, storage class, and other attributes of a function. To be a prototype, the function declaration must also establish types and identifiers for the function’s arguments.   Syntax  declaration :  declaration-specifiers attribute-seq opt init-declarator-list opt ;  /* attribute-seqopt is Microsoft Specific */   declaration-specifiers :  storage-class-specifier declaration-specifiers opt type-specifier declaration-specifiers opt type-qualifier declaration-specifiers opt  init-declarator-list :  init-declarator init-declarator-list , init-declarator  init-declarator :  declarator declarator = initializer  declarator :  pointer opt direct-declarator  direct-declarator : /* A function declarator */   direct-declarator ( parameter-type-list )      /* New-style declarator */ direct-declarator ( identifier-list opt )    /* Obsolete-style declarator */  The prototype has the same form as the function definition, except that it is terminated by a semicolon immediately following the closing parenthesis and therefore has no body. In either case, the return type must agree with the return type specified in the function definition.   Function prototypes have the following important uses:   They establish the return type for functions that return types other than int. Although functions that return int values do not require prototypes, prototypes are recommended.   Without complete prototypes, standard conversions are made, but no attempt is made to check the type or number of arguments with the number of parameters.   Prototypes are used to initialize pointers to functions before those functions are defined.    The parameter list is used for checking the correspondence of arguments in the function call with the parameters in the function definition.  The converted type of each parameter determines the interpretation of the arguments that the function call places on the stack. A type mismatch between an argument and a parameter may cause the arguments on the stack to be misinterpreted. For example, on a 16-bit computer, if a 16-bit pointer is passed as an argument, then declared as a long parameter, the first 32 bits on the stack are interpreted as a long parameter. This error creates problems not only with the long parameter, but with any parameters that follow it. You can detect errors of this kind by declaring complete function prototypes for all functions.  A prototype establishes the attributes of a function so that calls to the function that precede its definition (or occur in other source files) can be checked for argument-type and return-type mismatches. For example, if you specify the static storage-class specifier in a prototype, you must also specify the static storage class in the function definition.   Complete parameter declarations (int a) can be mixed with abstract declarators (int) in the same declaration. For example, the following declaration is legal:    int add( int a, int );  The prototype can include both the type of, and an identifier for, each expression that is passed as an argument. However, such identifiers have scope only until the end of the declaration. The prototype can also reflect the fact that the number of arguments is variable, or that no arguments are passed. Without such a list, mismatches may not be revealed, so the compiler cannot generate diagnostic messages concerning them. See Arguments for more information on type checking.  Prototype scope in the Microsoft C compiler is now ANSI-compliant when compiling with the /Za compiler option. This means that if you declare a struct or union tag within a prototype, the tag is entered at that scope rather than at global scope. For example, when compiling with /Za for ANSI compliance, you can never call this function without getting a type mismatch error:  void func1( struct S * );  To correct your code, define or declare the struct or union at global scope before the function prototype:  struct S; void func1( struct S * );  Under /Ze, the tag is still entered at global scope.

user: user-8
content: 也可以老式K&R风格的声明： int func(a, b) {   return a + b; }

user: user-9
content: 函数声明可以省略变量名，只需要写出类型就可以了。但是在函数定义中必须把类型和形参名都写出来。

user: user-10
content: 函数实现时如果省略了参数名，那么表示函数中不引用参数的对象，如果函数中要使用参数，需要指定参数名

user: user-7
content: 这不是声明，是原型。