Home>Article>Backend Development> What are the methods of function calling in C language?
#What are the methods of function calling in C language?
How to call functions in C language:
1. The most common is to call directly
void fun(void) { ...... //你的代码 ..... } { ....... fun(); ..... }
2.Use function pointer
void fun(void) { printf("OK!\n"); } int main(void) { void (*pfun)(); pfun=fun; (*pfun)(); return 0; }
3. Function parameter method
void fun(void) { printf("OK!\n"); } { CallFun(fun);
In summary, there are three main methods of calling functions in C language: direct calling, function pointer calling, and function pointer passing calling. The latter two are essentially the same, but there are slight differences in whether there is a return value.
The above is the detailed content of What are the methods of function calling in C language?. For more information, please follow other related articles on the PHP Chinese website!