isprint in c

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

What is isprint in c programming?

isprint in c is used to check whether the passed character is printable or not.

This function is defined in ctype.h header file.

Printable character does not include control character.

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

Prototype

int isprint(int c);

Parameter

This function takes integer as input parameter.

Return value

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


Example program for isprint function in c

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

Code explanation

isprint function is called to check whether the passed character is printable or not. The result is being copied on to the console.

isprint() Man page


Difference between isprint and printf in c

isprint is used to check whether the passed character is printable or not. printf function is used to print the given value onto the output screen.

isprint function is included in ctype.h header file. printf is included in stdio.h header file.

isprint returns non-zero digit if passed value is printable character otherwise zero. printf function returns a total number of characters written otherwise negative number.

Prototypes are as follows

int isprint(int c);

int printf(const char* format,....);
isprint function in cprintf function in c
Used to check whether the passed character is printable or not.Used to print the given value onto the output screen.
int isprint(int c);int printf(const char* format,....);

People also ask for

What is isprint in c?

isprint in c is used to check whether the passed character is printable or not. It is defined in ctype.h.

What is the difference between isparint and fprintf in c?

isprint in c is used to check whether the passed character is printable or not. fprintf function in c is used to format the output to a file instead of stdout console.