标签:
模拟源码实现:
int isspace(int c) { return (c == ' ' || c == '\t' || c == '\n' || c == '\r' || c == '\f' || c == '\v'); }
#include <stdio.h> #include <ctype.h> main() { char str[]="a3 4\t%\r8\n9 [\ve\f?"; int i = 0; for(i=0;str[i]!=0;i++) { if(isspace(str[i])) { printf("%c 是空格\n",str[i]); } else { printf("%c 不是空格\n",str[i]); } } }运行结果:
标签:
原文地址:http://blog.csdn.net/kongshuai19900505/article/details/51559609