Ctype.h header file




















This function returns non-zero value if c is a digit or a letter, else it returns 0. But the statements given below assign 0 to the variable n, since the given character is neither an alphabet nor a digit. Type a Character :A. The Return Value of isalnum ch is Type a Character :? The isalpha function is used to check whether the given character is an alphabet or not. This function will return 1 if the given character is an alphabet, and 0 otherwise 0. The following statement assigns 0 to the variable n, since the given character is not an alphabet.

But, the statement given below displays 1, since the given character is an alphabet. Enter a charater: A.

The Return Value of isalpha ch is Enter a charater: 7. This function is used to check whether a given character is a digit or not. This function will return 1 if the given character is a digit, and 0 otherwise. When the following program is executed, the value of the variable n will be 1,since the given character is not a digit.

Enter a Character: 3. The Return Value of isdigit ch is Enter a Character: A. This function is used to check whether a character is in lower case small letter or not. This functions will return a non-zero value, if the given character is a lower case alphabet, and 0 otherwise. After executing the following statements, the value of the variable n will be 1 since the given character is in lower case.

But the statement given below will assign 0 to the variable n, since the given character is an uppercase alphabet. This function is used to check the given character is uppercase. This function will return 1 if true otherwise 0. For the following examples value 1 will be assigned to n and 0 for m.

This function is used to convert the given character into its uppercase. This function will return the upper case equivalent of the given character. If the given character itself is in upper case, the output will be the same. Returns 0 if the passed argument is not a white-space character Returns nonzero value if the passed argument is a white-space character Returns 0 if the passed argument is not an uppercase alphabet Returns nonzero value if the passed argument is an uppercase alphabet Returns 0 if the passed argument is not a hexadecimal digit Returns nonzero value if the passed argument is an hexadecimal digit Returns lowercase alphabet of the corresponding uppercase alphabet Returns uppercase alphabet of the corresponding lowercase alphabet Below are examples to implement some of the above functions:.

Skip to content. Change Language. Related Articles. Table of Contents. Save Article. Like Article. Output: The number of alphabets are 24 The number of digits are 4. Output: No. Output: Hello Everyone. Welcome to GeeksForGeeks portal. Take a step-up from those "Hello World" programs. Learn to implement data structures like Heap, Stacks, Linked List and many more!

Check out our Data Structures in C course to start learning today. Previous Puzzle Probability of finding a job. Next How to initialize a list in a single line in Java with a specified value?

Recommended Articles. How to print range of basic data types without any library function and constant in C?



0コメント

  • 1000 / 1000