😸
[C] ispunct 関数
機能
指定した文字が句読点文字(記号)かどうかを判定する関数[1]
使用例
1
と表示する
\n
は改行を表す エスケープシーケンス[2]
コード
printf("%d\n", ispunct('!'));
全文
#include <stdio.h>
#include <ctype.h>
void main() {
printf("%d\n", ispunct('!'));
}
実行結果
1
0
を変数から表示する
コード
char ch = 'A';
printf("%d\n", ispunct(ch));
全文
#include <stdio.h>
#include <ctype.h>
void main() {
char ch = 'A';
printf("%d\n", ispunct(ch));
}
実行結果
0
Discussion