😸

[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
脚注
  1. 英数字、空白以外の記号類(! " # $ % & 等)を判定する。 ↩︎

  2. 改行やタブなど、画面に表示されない制御文字のこと。 ↩︎

Discussion