Saturday, March 6, 2021

, , , , ,

Example program for ispunct in c

 The ispunct() function in c programming checks whether a character is a punctuation mark or not.

Syntax for ispunct() in c

int ispunct(int argument);

it returns a non-zero integer if given characters to ispunct() in c is an punctuation otherwise return 0.

Example for Program to check punctuation with the help of ispunct() function in c:-

#include <stdio.h>
#include <ctype.h>

int main() {
   char c;
   int result;

   c = ':';
   result = ispunct(c);

   if (result == 0) {
      printf("%c is not a punctuation", c);
   } else {
      printf("%c is a punctuation", c);
   }

   return 0;
}

 Output

ispunct
ispunct in c

 

 

0 comments:

Post a Comment