Three ways to call functions: 1. The function appears in the expression as an item in the expression, for example "z=max(x,y)"; 2. The function appears as a separate statement, For example "printf("%d",a)"; 3. The function is used as an actual parameter when calling another function, for example "printf("%d",max(x,y))".
The operating environment of this tutorial: windows7 system, c99 version, Dell G3 computer.
The so-called function call is to use a defined function. The general form of function call is:
functionName(param1, param2, param3 ...);
functionName is the function name, param1, param2, param3... is the actual parameter list. Actual parameters can be constants, variables, expressions, etc. Multiple actual parameters are separated by commas.
In C language, there are many ways to call functions, such as:
//1、函数作为表达式中的一项出现在表达式中 z = max(x, y); m = n + max(x, y); //2、函数作为一个单独的语句 printf("%d", a); scanf("%d", &b); //3、函数作为调用另一个函数时的实参 printf( "%d", max(x, y) ); total( max(x, y), min(m, n) );
Related recommendations: "C Language Video Tutorial"
The above is the detailed content of What are the three ways to call functions in C language?. For more information, please follow other related articles on the PHP Chinese website!