Lets say i've got functions named Function1,Function2,Function3 etc. Is there a way of calling one of the functions in a loop each time?
for(i=1;i<Max;i++)
{
Function^();
}
Try this:
#include <stdio.h>
void func1(void)
{
printf( "func1\n" );
}
void func2(void)
{
printf( "func2\n" );
}
void func3(void)
{
printf( "func3\n" );
}
typedef void ( *func )(void);
int main(void)
{
func m_func[3] = {func1, func2, func3};
int index;
for( index = 0; index < 3; index++ )
{
m_func[index]();
}
return 0;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With