修改程序清单8.8中的get_first()函数,使其返回所遇到的第一个非空白字符,在一个简单的程序
中测试。
#include <stdio.h>
#include <ctype.h>
#include <windows.h>
char get_first(void);
int main(void)
{
char ch;
ch = get_first();
printf("%c\n", ch);
system("pause");
return 0;
}
char get_first()
{
int ch;
while (isspace(ch = getchar()))
continue;
while (getchar() != '\n')
continue;
return ch;
}
本文介绍了一个C语言程序,该程序修改了get_first()函数来获取第一个非空白字符,并在主函数中进行了测试。
745

被折叠的 条评论
为什么被折叠?



