// Table definition:
typedef long (*functs)(char c);
functs JumpTable[] = { DoOne,DoTwo,DoThree /* etc*/} ;
// some code that uses the table:
long result = JumpTable[selector](i++);
转移表的内在的基本思路在于:将待调用函数的指针插入表中,用选择项作为表的索引
具备了if else功能
// Table definition:
typedef long (*functs)(char c);
functs JumpTable[] = { DoOne,DoTwo,DoThree /* etc*/} ;
// some code that uses the table:
long result = JumpTable[selector](i++);
转移表的内在的基本思路在于:将待调用函数的指针插入表中,用选择项作为表的索引
具备了if else功能