×

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

Double Specifier in C

What is a double specifier? The term double denotes the double data type in C. It more accurately depicts floating point numbers. The idea that it has twice the precision of...

3 minutes read.

Multithreading in C interview questions

Q1. What exactly is a thread? Ans: A thread is a brief sequence of instructions intended to be planned and carried out by the CPU apart from the parent process. Q2. Can...

4 minutes read.

Beep() function in C

Introduction: Beep is a function which is used in C programming language. The beep function uses to make a beep sound. In the C language, when we want to generate...

3 minutes read.

What is algorithm in C?

What is an algorithm? In computer programming languages, an algorithm is set of statement that solves a particular problem. In C, first step of every algorithm is Start and last step of...

3 minutes read.

Socket Programming in C

Socket programming is a process that connects the two or more nodes on a networking communication with respective to each other. One of the sockets that determines the socket (I.e.,...

5 minutes read.

Queue implementation in C

In the C programming language, the queue is the abstract concept that is similar to stacks. However, it is the part of the data structures that work opposite to that...

4 minutes read.

Merge Sort in C

The merge sort follows the principle of the divide and conquers algorithm. Firstly it divides the input of an array into two halves and then calls itself for the two...

4 minutes read.

Assert() Function in C

Assert (): In C, the statements are executed with the exit statement. In C language declare, and it tests the condition parameters. If the statement executed will be false, it...

3 minutes read.

Prime Number Program in C using for Loop

In this article, we will know about the procedure of checking whether a natural number inputted by the user is a prime number or non-prime number. Definition of the prime number A...

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.

C and C++ Binary Files

What is a binary file? A file in which the content is written in binary format is called a binary file. A binary file is not a text file. There are...

7 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.

How to create a binary file in C?

Creating a binary file in C language is very simple, requiring only some specific functions to be implemented. There are also other binary modes: read, and write, which will be...

7 minutes read.

Dangling pointers in C

Dangling pointers in C: A pointer is a variable that stores the memory address of other variables. The pointers may also store the address of other’s memory items. They are...

4 minutes read.

Round Robin Scheduling in C

Round Robin Scheduling in C Round robin is a CPU (Central Processing Unit) scheduling algorithm designed to share the time systems. It is one of the simplest and easiest scheduling algorithms...

4 minutes read.

Tower of Hanoi in C

What is Tower of Hanoi? The Tower of Hanoi is a gaming problem that was created in 1883 by a French mathematician named Édouard Lucas. The Tower of Hanoi temple in...

4 minutes read.

Find out Power without using POW function in C

Introduction: In this discussion, we will discuss how we find out power without using the POW function in C. In this article, you'll understand how to compute integer powers in...

3 minutes read.

Different ways to Declare the Variable as Constant in C

There are a wide range of ways of making the variable as steady Using const keyword: The const catchphrase permits a software engineer to inform the compiler that a specific variable should...

5 minutes read.

Factorial Program in C Using While Loop

Before looking into the mechanism of factorial program, first, you have to understand about the working of a while loop. While Loop The syntax that has been used for the “while” loop...

4 minutes read.

Add two numbers using the function in C

Here we will learn how to add two numbers by creating function in C. Let’s learn this with help of example. Code: - #include <stdio.h> int add_two_no(int a, int b); int main(){   int first_num,...

1 minute read.