回复 10楼 陈光星
注意排版 缩进 不必要的空行 等等

DO IT YOURSELF !
#include<stdio.h> #include <stdlib.h> #include <time.h> void foo1() { printf("测试1\n"); } void foo2() { printf("测试2\n"); } void foo3() { printf("测试3\n"); } void (*f)(); int main() { srand((unsigned)time(NULL)); int s=rand()%3+1; if(s==1) { f=foo1; f(); } if(s==2) { f=foo2; f(); } if(s==3) { f=foo3; f(); } return 0; }
[此贴子已经被作者于2017-6-12 09:48编辑过]