C 中的 ispunct()
函式 ispunct() 用於檢查所傳遞的字元是否為標點符號。如果不是標點符號,則返回零;否則返回一個非零值。
以下是在 C 語言中 ispunct() 的語法:
int ispunct(int character);
以下是在 C 語言中 ispunct() 的一個示例:
示例
#include <stdio.h>
#include<ctype.h>
int main() {
int a = '!';
int b = 'a';
if(ispunct(a))
printf("The character is a punctuation.");
else
printf("
The character is not a punctuation.");
if(ispunct(b))
printf("
The character is a punctuation.");
else
printf("
The character is not a punctuation.");
return 0;
}輸出
The character is a punctuation. The character is not a punctuation.
廣告
資料結構
網路
RDBMS
作業系統
Java
iOS
HTML
CSS
Android
Python
C 程式設計
C++
C#
MongoDB
MySQL
Javascript
PHP