C islower() Function Tutorial

In this section, we will learn what the islower() function is and how to use it in C.

islower() in C

The `islower()` function is used to check whether a character is a `lowercase alphabet character`. (a-z)

The prototype of the function exists in the `ctype.h` header file and we need to include this header file in order to use ` islower ()` function.

islower() Function Syntax

Here’s the prototype of the ` islower ()` function:

int islower (int argument);

islower() Function Parameters

This function takes one argument and that is the character that we want to check.

islower() Function Return Value

The return value of the function is:

  • 0: If the character was not a `lowercase alphabet`.
  • Positive value: if the character was in fact a `lowercase alphabet`.

Example: using islower() function in C

#include <stdio.h>
#include <ctype.h>

int main() {

    char character = 'a';
    char c2 = 'A';

    printf("The first character: %d \nThe second character: %d", islower (character), islower (c2));

    return  0;
}

Output:

The first character: 2

The second character: 0

The first character in this example is `a` and so the result of calling the `islower` function is a positive value because `a` is a lowercase alphabet character. But the result of the second character is 0 because the actual value of the character is `A` and it’s not a `lowercase alphabet`.

Facebook
Twitter
Pinterest
LinkedIn

Top Technologies