L
luserXtrog
Check the OPs posting history on this group and you will see that it
normally posts complete rubbish. The best thing to do is ignore it.
ACK
Check the OPs posting history on this group and you will see that it
normally posts complete rubbish. The best thing to do is ignore it.
Skybuck said:The intention ofcourse is to execute different code based on the value of A
like a case statement in pascal or a switch in C.
A = 4;A ? B = 1; C = 2; D = 3; E = 4; F = 5;A ? Init(); Work(); Draw(); Next(); CleanUp();
I would write that, this way:
func[A]();
/* BEGIN new.c */
#include <stdio.h>
void Init(void);
void Work(void);
void Draw(void);
void Next(void);
void CleanUp(void);
int main(void)
{
void (*func[])(void) = {Init,Work,Draw,Next,CleanUp};
size_t A;
for (A = 0; A != sizeof func / sizeof *func; ++A) {
func[A]();
}
return 0;
}
void Init(void)
{
puts("Init");}
void Work(void)
{
puts("Work");
}
void Draw(void)
{
puts("Draw");
}
void Next(void)
{
puts("Next");
}
void CleanUp(void)
{
puts("CleanUp");
}
/* END new.c */
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.