循环执行函数.c 284 B

123456789101112131415161718
  1. #include <stdio.h>
  2. void func0() {
  3. puts("this is the function func0().");
  4. }
  5. void func1() {
  6. puts("this is the function func1().");
  7. }
  8. int main() {
  9. void (*funcTable[2])(void) = {func0, func1};
  10. for (int i = 0; i < 2; ++i) {
  11. funcTable[i]();
  12. }
  13. return 0;
  14. }