Float in islower() in C
Introduction: This article briefly discusses the float in islower() in C. The islower() function checks if the input character passed inside the function is lowercase. Lowercase letters include (a-z). The islower() function is defined in the ctype.h header file.
Syntax of the float in islower() function in C: The syntax of the islower() function in C language is given below –
int islower(int c);
Parameter of the float in islower() function in C: The parameter of the islower() function is c. This is the character to check for. Only one parameter is required. c represents the character that should be checked.
Return value of the float in islower() function in C: After using the islower() function, it can return two possible values. This function returns non-zero (true) if c is lowercase and zero (false) otherwise. They can be -
Non-zero values: If the character passed to the islower() function is lowercase; a non-zero value is returned.
0: If the character is not lowercase, the function returns zero (0).
Header file of the float in islower() function in C: The header file of the islower() function in C is ctype.h header file.
Implementing the islower() function in C programming: The islower() function in the C program checks whether characters are entered in lowercase rather than uppercase. Returns a non-zero number only if the character is one of a to z.
This function is declared in the ctype.h header file. The islower() function definition is in this file, so you need to include this header file to use this function. For each character, the islower() function returns a non-zero value.
Example is:
If the input value is ‘A,’ then the output value is 0. When the input value is ‘p’, the output is a non-zero value. If the input value is a unique character like ‘#,’ then the result is 0.
Algorithm of the islower() function in C: Here, we discuss the algorithm of the islower() function in C.
Step 1: At first, Initialize 0 as a counter variable.
Step 2: First, transverse the string individually.
Step 3: Make sure that every person of the string is handed into the islower() function.
Step 4: Increment the value of the counter fee utilizing one each time a non-zero value is returned using the islower() feature.
Step 5: Use the break() declaration to pop out of the loop while the conditions have encountered the null individual. The only disadvantage of this method is that the string must contain precisely one null value on the end.
Step 6: Returns the cost of a counter representing the wide variety of lowercase characters in a string. Print the fee within the most important function.
Example 1: We give the example of the islower() function is C. The example is given below.
#include <stdio.h>
#include <ctype.h>
int main()
{
char ch;
printf (“Enter a character value: ”);
scanf (“%c”, &ch);
if (islower(ch) == 0)
printf (“The given character %c is not a lowercase alphabet”, ch);
else
printf (“The given character %c is a lowercase alphabet”, ch);
return 0;
}
Output: We compile the above program and also run it. The result is given below –
Enter a character value: r
The given character r is a lowercase alphabet
Example 2: We give another example of an islower() function is C. The example is given below.
#include <stdio.h>
#include <ctype.h>
int main (int argc, const char * argv[] )
{
int letter;
letter = ‘p’;
if (islower(letter)) printf (“%c is lowercase character\n”, letter);
else
printf (“%c is uppercase character\n”, letter);
letter = ‘R’;
if (islower(letter)) printf (“%c is lowercase character\n”, letter);
else
printf (“%c is uppercase character\n”, letter);
return 0;
}
Output: We compile the above program and also run it. The result is given below –
p is a lowercase character
R is an uppercase character
Example 3: We give another example of an islower() function is C. The example is given below.
#include <stdio.h>
#include <ctype.h>
int main ()
{
int char1 = 'P';
int char2 = 'p';
int char3 = '5';
if (islower(char1))
{
printf("char1 = %c is lowercase character\n", char1 );
}
else
{
printf("char1 = %c is not lowercase character\n", char1 );
}
if (islower(char2))
{
printf("char2 = %c is a lowercase character\n", char2 );
}
else
{
printf("char2 = %c is not lowercase character\n", char2 );
}
If (islower(char3))
{
printf("char3 = %c is a lowercase character\n", char3 );
}
else
{
printf ("char3 = %c is not a lowercase character\n", char3 );
}
return 0;
}
Output: We compile the above program and also run it. The result is given below –
char1 = P is not a lowercase character
char2 = p is a lowercase character
char3 = 5 is a not lowercase character
So, here we briefly discuss the islower() function in C. We also share the parameter, return value, syntax, header file, etc. And lastly, give some examples to clarify this topic.