Is using a while block to do nothing a bad thing?

后端 未结 12 967
予麋鹿
予麋鹿 2021-02-01 03:29

I\'m currently working through the excercises in \'The C Programming Language\'. Here\'s one of my solutions:

int c;

while ((c=getchar()) != EOF) {

if (c == \         


        
12条回答
  •  甜味超标
    2021-02-01 04:02

    An alternative option which hasn't been mentioned yet:

    while(condition)
        (void)0;
    

    I really do not prefer to write my loops this way, but I had a TA last semester who did.

提交回复
热议问题