tolower()

Convert a character to lowercase

Synopsis:

#include <ctype.h>

int tolower( int c );

Since:

BlackBerry 10.0.0

Arguments:

c
The character that you want to convert. This must be representable as an unsigned char or be EOF; the behavior for other values is undefined.

Library:

libc

Use the -l c option to qcc to link against this library. This library is usually included automatically.

Description:

The tolower() function converts c to a lowercase letter, if c represents an uppercase letter.

Returns:

The corresponding lowercase letter when the argument is an uppercase letter; otherwise, the original character is returned. If the original character can't be represented as an unsigned char and isn't EOF, the behavior is undefined.

Examples:

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

char chars[] = {
    'A',
    '5',
    '$',
    'Z'
};

#define SIZE sizeof( chars ) / sizeof( char )

int main( void )
  {
    int   i;

    for( i = 0; i < SIZE; i++ ) {
    printf( "%c ", tolower( chars[ i ] ) );
    }
    printf( "\n" );
    return EXIT_SUCCESS;
  }

produces the output:

a 5 $ z

Classification:

ANSI, POSIX 1003.1

Safety:  
Cancellation point No
Interrupt handler Yes
Signal handler Yes
Thread Yes

Last modified: 2014-06-24



Got questions about leaving a comment? Get answers from our Disqus FAQ.

comments powered by Disqus