Home>Article> A C program has one and only one function

A C program has one and only one function

尚
Original
2020-04-18 13:25:24 18995browse

A C program has one and only one function

A C program has one and only one main function (main() function). A C language source program can be composed of one or more source files. No matter how many files a source program consists of, there is one and only one main function, that is, the main function.

The main function is the entry function of the C program, that is, the execution of the program starts from the main function, and the mobilization of other functions is also directly or indirectly called in the main function.

The biggest feature of C programs is that all programs are assembled using functions. main() is called the main function and is the entry point for all program operations. The remaining functions are divided into parameterized and parameterless, and are called by the main() function or other general functions. If a parameterized function is called, the parameters are passed during the call.

int main(void)//整数类型 主函数(无类型) { ... y1=f1(x1,x2);//赋值过程 ... } f1(int a,int b)//f1(整数类型 a,整数类型 b) { //示例代码..... Y2=f2(x3,x4);//赋值过程 //示例代码 } f2(int m,int n)//f2(整数类型 m,整数类型 n) { //示例代码 }

Recommended: "c Language Tutorial"

The above is the detailed content of A C program has one and only one function. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn