Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - Problems with function calling classes in C language, please explain urgently
Problems with function calling classes in C language, please explain urgently

void CallMyFun(FunType fp,int x); is a function containing a function pointer!

fp is just the name of the function pointer, which is the formal parameter of the CallMyFun function. You can choose this name at will.

When calling CallMyFun(MyFun1,10); // Assume that this variable is called When

fp refers to the MyFun1 function, where do the parameters of MyFun1 come from? It is passed in through the second parameter of CallMyFun, here is 10

So running the CallMyFun(MyFun1,10); function actually runs call MyFun1(10)

So Running the CallMyFun(MyFun2,20); function actually runs call MyFun2(20)

So fp(x) refers to a function. If you want to output its result, then define MyFun1, When MyFun2 is used, the function needs to have a return value and cannot use void