I have similar macros defined with just difference in them is number. e.g
#define Function_01_Call(param) (FunctionName((int)01, param))
#define Function_02_Call(param) (FunctionName((int)02, param))
#define Function_03_Call(param) (FunctionName((int)03, param))
#define Function_04_Call(param) (FunctionName((int)04, param))
I want to call function FunctionName using macros Function_XX_Call. How can I use one string for macro with change in its numbers? I tried with
#define FUNCTION_CALL(num) Function_num_Call
int main()
{
char num;
for(num = "01"; num<="04"; num++)
{
FUNCTION_CALL(num); //HOW TO PASS param HERE?
}
}
but how can I change the num dynamically during call as Variables cannot be used in macro. Also how to pass the param during call? Is there any way to use function pointers?