isspace in c

If you want know isspace in c then read this blog post.

What is isspace in c programming?

isspace in c checks whether the passed character is whitespace or not.

Whitespace characters include tab space, newline, vertical bar, carriage return.

This function is defined in ctype.h header file.

This function returns non-zero digit if passed character is whitespace otherwise zero.

Prototype

int isspace(int a);

Parameter

This function takes character as input parameter and converts it into ASCII value.

Return value

This function returns non-zero value if passed character is whitespace otherwise zero.


Example program for isspace in c

#include<stdio.h>
#include<ctype.h>
int main()
{
  char x='\n';
  if(isspace(x))
    printf("This is an whitespace character \n");
  else
    printf("This is not an whitespace character \n");
  return 0;
}
Example for isspace in c programming

Code explanation

The given character is whitespace or not is determined by passing it the isspace function. The result is being printed onto the console.

isspace() Man page


Difference between isspace and isblank in c

isspace function checks the input character is whitespace or not. isblank in c checks whether the passed character is blank or not.

isspace simply returns character is space or not. isblank function is used to identify blank spaces between words in a text of line.

Prototypes are as follows

int isspace(int a);

int isblank(int a);
isspace in cisblank in c
Checks the input character is whitespace or not.Checks whether the passed character is blank or not
int isspace(int a);int isblank(int a);

People also ask for

What is isspace in c?

isspace function checks the input character is whitespace or not. This function is defined in ctype.h header file.

What is the difference between iscntrl and isspace in c?

iscntrl function terminates the process when it encounters a control character. isspace simply returns character is space or not.