I would like to pass function name to another function, How to use & implement int myMethod char arg functionality passing arguments for program.
Code:MyObject:: myMethod (Program) ( MyMacro (Program); )
I would like to pass function name to another function, How to use & implement int myMethod char arg functionality passing arguments for program.
Code:MyObject:: myMethod (Program) ( MyMacro (Program); )
When a function is called, any arguments that are provided by the caller are simply treated as expressions.You never pass a function name to another function, you actually pass function address as argument to another function. When you pass their arguments by reference, which means that the compiler passes a list of addresses pointing to the arguments to be passed.
Code:#include <stdio.h> void increment(int); int main(void) { int cnt = 6; increment(cnt); printf("cnt = %d\n", cnt); return(0); } void increment(int y) { ++y; printf("y = %d\n", y); }
Call by value :
Code:void called_func(int, float); main(){ called_func(2, 2*3.5); exit(EXIT_SUCCESS); } void called_func(int g, float arg){ float tp; tp = g * arg; }
Bookmarks