Register | Sing In

New posts

Stacks in C programming Linked Lists in C programming File Input/Output in C programming Check prime numbers in C Programming C Programming Enumeration C Programming Union

Archives

2013-10 2013-09 2013-08

C library function - toisspace()

September 6, 2013 Posted by: GPA Views: 997 0 comments

Problem

C library function - toisspace(). Write simple application using this function.

Solution

This function checks if input parameter is white-space character—newline ('\n'), space (' '), form feed ('\f'), carriage return ('\r'), horizontal tab ('\t') or vertical tab ('\v'). For using this function you must include <ctype.h> library.

Declaration:

int toisspace(int value); 

where value is the character to be checked. 

It returns a 1 (true) value if value is a white-space character — newline ('\n'), space (' '), form feed ('\f'), carriage return ('\r'), horizontal tab ('\t') or vertical tab ('\v')—and 0 (false) otherwise.

Example:

 

   

#include <stdio.h>
#include <ctype.h>
int main(int argc, char *argv[])
{
    char value;
    printf("globalproganswer.com\n");
    printf("Enter some value: ");//promt user to enter some value
    scanf("%c",&value);//read from keyboard
   //call function isalnum and show result
   if(isspace(value)) {
       printf("This value is white-space character or horizontal tab \nor space or newline or vertical tab or feed or carriage return\n");
    } else {
       printf("No variants\n");
   }
   system("PAUSE");//delay
   return 0;
}

Output

c library function - toisspace

Download this example

0 Comments...

Leave a Reply

Please, Sing In to leave a Reply for this material.



Online Chat

LiveZilla Live Help

Popular posts

Function strtok in C programming Check prime numbers in C Programming C Programming Union Linked Lists in C programming File Input/Output in C programming C Programming Enumeration

RSS-subscribe

New materials

Subscribe