C library function - islower()

Advertisements


Description

The C library function int islower(int c) check whether the passed character is lowercase letter.

Declaration

Following is the declaration for islower() function.

int islower(int c);

Parameters

  • c -- This is the character to be checked.

Return Value

This function returns a non zero value(true) if c is a lowercase alphabetic letter else, zero (false)

Example

The following example shows the usage of islower() function.

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

int main()
{
   int var1 = 'Q';
   int var2 = 'q';
   int var3 = '3';
    
   if( islower(var1) )
   {
       printf("var1 = |%c| is lowercase character\n", var1 );
   }
   else
   {
      printf("var1 = |%c| is not lowercase character\n", var1 );
   }
   if( islower(var2) )
   {
       printf("var2 = |%c| is lowercase character\n", var2 );
   }
   else
   {
      printf("var2 = |%c| is not lowercase character\n", var2 );
   }
   if( islower(var3) )
   {
       printf("var3 = |%c| is lowercase character\n", var3 );
   }
   else
   {
      printf("var3 = |%c| is not lowercase character\n", var3 );
   }
   
   return(0);
}

Let us compile and run the above program, this will produce the following result:

var1 = |Q| is not lowercase character
var2 = |q| is lowercase character
var3 = |3| is not lowercase character


Advertisements
Advertisements