ฟังก์ชัน ispunct() ใช้เพื่อตรวจสอบว่าอักขระที่ส่งผ่านเป็นเครื่องหมายวรรคตอนหรือไม่ คืนค่าศูนย์ หากไม่ใช่เครื่องหมายวรรคตอน มิฉะนั้นจะส่งกลับค่าที่ไม่ใช่ศูนย์
นี่คือไวยากรณ์ของ ispunct() ในภาษา C
int ispunct(int character);
นี่คือตัวอย่าง ispunct() ในภาษา C
ตัวอย่าง
#include <stdio.h>
#include<ctype.h>
int main() {
int a = '!';
int b = 'a';
if(ispunct(a))
printf("The character is a punctuation.");
else
printf("\nThe character is not a punctuation.");
if(ispunct(b))
printf("\nThe character is a punctuation.");
else
printf("\nThe character is not a punctuation.");
return 0;
} ผลลัพธ์
The character is a punctuation. The character is not a punctuation.