打印1000,用函数指针数组作为递归的跳出条件

打印1000,用函数指针数组作为递归的跳出条件#include <stdlib.h>#include <stdio.h>void go(void){;}void quit(void){exit(0);}void (*where_to_go[2])(void)={go, quit};void calc(int current, int end){where_to_go[(current-1)/end]();// printf("%dt%dt%dn", current, end, current/end);printf("%dt",current);calc(++current, end);}main(){calc(1, 1000);printf("n");}

Leave a Reply