Name

tolower - convert letter to lower case

Library

libc.lib

Synopsis

  #include <ctype.h>
  int tolower (int c);

Return values

If the argument is an upper-case letter, the tolower function returns the corresponding lower-case letter if there is one; otherwise the argument is returned unchanged. The towlower function should be used instead.

Detailed description

The tolower function converts an upper-case letter to the corresponding lower-case letter. For single character representations, the value of the argument is representable as an unsigned char or the value of EOF.

The functionality of this API is independent of the program’s current locale.


Examples

#include<ctype.h>  //tolower()
#include<stdio.h> //printf()
int test_tolower ()
{
   struct st
   {
    int input;
    int output;
   };
   struct st  arr[]=
   {
   { ’Q’, ’q’ },
   { ’g’ , ’g’ },
   { ’9’ , ’9’ },
   { ’%’ , ’%’ },
   { ’\t’ , ’\t’ },
   };
   int i = 0;
   int size = 5;
   for( i=0; i<size; i++)
   {
      int ret = tolower(arr[i].input);//call to the API with the chars in the arr[]
      if( ret != arr[i].output )
      {
         printf("\n%c cannot convert ", arr[i].input);
      }
      else
      {
         printf("\n%c ", arr[i].output);
      }
   }
printf("\n");
}

         

Output

q
g
9
%

         

See also

islower, towlower, defns

Feedback

For additional information or queries on this page send feedback

© 2005-2007 Nokia

Top