/*6.修改程序清单 8.8 中的 get_first()函数,使其返回所遇到的第一个非空白字符。在一个简单的程序中测试该函数。*/
#include<stdio.h>
#include<stdlib.h>
#include<ctype.h>
char get_first(void);
int main()
{
putchar(get_first());
system("pause");
return 0;
}
char get_first(void)
{
int a;
while ((a = getchar()) != EOF)
{
if (!isspace(a) && (a != '\n'))
return a;
}
}
C Primer Plus8-6
最新推荐文章于 2022-04-13 03:58:46 发布
本文介绍了如何修改程序清单8.8中的get_first()函数,使其能返回输入字符串中的第一个非空白字符,并通过简单程序进行验证。重点在于理解和实现字符处理函数。
847

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



