开发者

Print 1 to 100 with out loop and conditions in C [duplicate]

开发者 https://www.devze.com 2023-02-09 04:42 出处:网络
This question already has answers here: Closed 12 years ago. Possible Duplicate: Printing 1 to 1000 without loop or conditionals
This question already has answers here: Closed 12 years ago.

Possible Duplicate:

Printing 1 to 1000 without loop or conditionals

code to print 1 to 100 without using loops and 开发者_开发技巧conditions.


void print(){        
static int i;

printf("%d\n",++i);

}

void exitme(){ exit(1); }

int main(){

       void (*p[2])()={print,exitme};
       static int i;
       (p[i++/100])();
       main();
}
0

精彩评论

暂无评论...
验证码 换一张
取 消