当前位置:网站首页>Construction of functions in C language programming

Construction of functions in C language programming

2022-04-23 17:32:00 wx625ea460982ad

Constructor's Purpose : To simplify the program and make your program easier for others to understand

what situation Next recommended constructor : When a function in the program needs to be used many times and the code to realize is long , It's recommended to do it in advance

Yes? Constructors : Simply speaking , What do you want to achieve , Just construct what kind of function

such as : I want to add two numbers . The procedure is as follows :

#include<stdio.h>

int ADD (intx,inty)

{  int z=x+y;

return z;

}

int main()

{  int a=10;

int b=20;

int sum =0;

sum=ADD(a,b);

printf("%d\n",sum);

return 0;

| From this program, we can see , I want to add and subtract two numbers , So I'm in main Define a in advance between functions ADD function , Its function is to add two numbers , Then call this function directly in the main program .


版权声明
本文为[wx625ea460982ad]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204231612468279.html