switch (Command), Command od table.
switch
switch (*Command) {
}
, *Command char, 1 . 2 , .
:
static char table[] = {ID_01, ID_02 ,ID_03, ID_04, .... , ID_LAST}
16-
static unsigned short table[]={ID_01, ID_02 ,ID_03, ID_04, .... , ID_LAST}
process, unsigned short
void process( const unsigned short *table) {
int LastId = 0;
unsigned short *Command;
for ( Command=table; LastId==0 ; Command++){
switch(*Command) {
}
}
process:
void process(const unsigned short *table, size_t tableLen) {
while (tableLen--) {
switch (*table) {
case ID_1: break;
}
table++;
}
}
static unsigned short table[] = {ID_1, ID_2, ID_3, ..., ID_n};
process(table, sizeof(table)/sizeof(table[0]));