C++ islower()

islower() Prototype

int islower(int ch);

The islower() function checks if ch is in lowercase as classified by the current C locale. By default, the characters from a to z (ascii value 97 to 122) are lowercase characters.

The behaviour of islower() is undefined if the value of ch is not representable as unsigned char or is not equal to EOF.

It is defined in <cctype> header file.

islower() Parameters

ch: The character to check.

islower() Return value

The islower() function returns non zero value if ch is in lowercase, otherwise returns zero.

Example: How islower() function works

#include <cctype>
#include <iostream>
#include <cstring>

using namespace std;

int main()
{
    char str[] = "This Program Converts ALL LowerCase Characters to UpperCase";

    for (int i=0; i < strlen(str); i++)
    {
        if (islower(str[i]))
            /*  Converting lowercase characters to uppercase  */
            str[i] = str[i] - 32;
    }

    cout << str;
    return 0;
}

When you run the program, the output will be:

THIS PROGRAM CONVERTS ALL LOWERCASE CHARACTERS TO UPPERCASE

Also Read:

Did you find this article helpful?

Our premium learning platform, created with over a decade of experience and thousands of feedbacks.

Learn and improve your coding skills like never before.

Try Programiz PRO
  • Interactive Courses
  • Certificates
  • AI Help
  • 2000+ Challenges