×

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. 


Related Topics

Stack implementation in C

Stack implementation in C Stack stores the data in a particular order. It is a linear data structure that follows the principle of the Last In First Out (LIFO) technique where...

3 minutes read.

Evaluation of Arithmetic Expression in C

We can use the "eval" function in C to evaluate an arithmetic expression stored as a string. However, using "eval" is generally considered bad practice and can lead to security...

4 minutes read.

String in C

String is a collection of character or group of characters. In array, string of character is terminated by a null value “\0” and enclose between double quote. We can declare...

2 minutes read.

C program to find factorial of a number using Recursion

What does the term "Factorial of a Number" mean? In mathematics, factorial is the product of all positive integers that are less than or equal to a certain positive integer, and...

2 minutes read.

Runtime vs compile time in C

In the C programming language, the often used terms in every step consist of compile time and runtime. The compile time is referred to the source code that will be...

4 minutes read.

C program that does not Suspend when Ctrl+Z is Pressed

In Programming when a program breakdown and runs surprisingly in the terminal compiler the developer has the ability to prevent the program from running unequivocally. For expressly halting the program,...

3 minutes read.

Formatted Input and output function in C

Formatted I/O functions display multiple outputs to the user by taking various inputs. All data types like int, float, char and double are supported by the formatted I/O function. In...

4 minutes read.

Flow Chart of Do while loop in C

This is a flowchart that represents the process of executing the Do while loop in the C programming language Generally, as we know there are three main components of Do While...

3 minutes read.

Type Conversion in the C

The process of changing one data type to another in the C programming language is known as "type conversion." The type conversion method is only executed on data types that...

4 minutes read.

Memory leak in C

What is memory leak in C? Memory leak occurs when we keep allocating memory in the heap without freeing it, i.e., the allocated memory in heap is not released back to...

3 minutes read.

Types Of Structures In C

We can normally store elements of the same datatype with the help of an array in C programming. We can store multiple numbers of elements of a character data type...

3 minutes read.

Error handling in C

Error handling in C: The C programming standard does not provide direct convenience for handling the errors. However, being a system programming language, it definitely will give access to handling...

4 minutes read.

getc() function in C

Getc is one of the file handling technique in C. The Getc() is a C library function gets the next character or new characters  from the specific stream and supports...

4 minutes read.

Binomial Coefficient Program in C

What is Binomial coefficient? In the given set of n possibilities, the binomial coefficient(n,k) indicates the order of choosing 'K' results from those possibilities. Binomial coeeficient of posistive n and k...

3 minutes read.

Builtin functions of GCC compiler

Certain built-in functions are present in the GCC compiler. These features are as follows: Function_ built in_popcount (x) The number of 1s in data of the integer type can be counted using...

3 minutes read.

Storage class in C

Storage class in C defines the scope, the visibility, and the lifetime of variables and functions. In other words, storage classes are used to describe the features of variables and...

3 minutes read.

pow() function in C

pow() function is one of the in-built functions present in math.h header file Power function is used to calculate the powers of the given number. The syntax of the power...

3 minutes read.

File Handling in C

File Handling is used to open, read, write, search and close file.  C files I/O functions handles data on secondary storage device. File handling function: There are varioushandling functions in C. Function Operation fopen() It is...

4 minutes read.

Run Time Polymorphism in C

What is polymorphism? Polymorphism refers to the existence of various forms. Polymorphism can be simply defined as a message's capacity to be presented in multiple forms. An individual who can have...

4 minutes read.

Enumeration (Enum) in C

Enumeration (Enum) in C: In the C programming language, the enum is referred to as an enumerated type. Enum is a user defined data type consisting of integer values and...

3 minutes read.