在 C++ 中,此函式的一個針對特定 locale 的模板版本 (isspace) 存在於標頭檔案 <locale> 中。
引數
c
要檢查的字元,轉型為int型別,或EOF.
返回值
如果 c 確實是空白字元,則返回一個非零值(即true) 如果 c 確實是一個空白字元。否則返回零 (即false)。
示例
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
/* isspace example */
#include <stdio.h>
#include <ctype.h>
int main ()
{
char c;
int i=0;
char str[]="Example sentence to test isspace\n";
while (str[i])
{
c=str[i];
if (isspace(c)) c='\n';
putchar (c);
i++;
}
return 0;
}