修改程序清单8.8中的get_first()函数,使其返回所遇到的第一个非空白字符。在一个简单的程序中测试该函数。
#include <stdio.h> #include <ctype.h> char get_first(void); int main(void) { char ch; while((ch = get_first() ) != EOF) { putchar(ch); } return 0; } char get_first(void) { int ch; while( isspace( ch = getchar() ) ); while ( getchar() != '\n'); return ch; }
这道题你会答吗?花几分钟告诉大家答案吧!
扫描二维码,关注牛客网
下载牛客APP,随时随地刷题