Skip to content

Latest commit

 

History

History
83 lines (54 loc) · 1.52 KB

031_tolower.asciidoc

File metadata and controls

83 lines (54 loc) · 1.52 KB

tolower

NAME

tolower - convert a character to its lower-case pendant.

SYNOPSIS
#include <ctype.h>

int tolower (int c);
DESCRIPTION

The tolower function converts c to a lowercase character. If c is not an alphabetic letter, the tolower function has no effect.

RETURN VALUE

The tolower function returns the lowercase equivalent of c.

SEE ALSO

toupper

Note
The details of what constitutes an uppercase or lowercase letter depend on the current locale. For example, the default "C" locale does not know about "umlauts", so no conversion is done for them.
In some non - English locales, there are lowercase letters with no corresponding uppercase equivalent; the German "sharp s" is one example.
EXAMPLE
link:src/tolower.c[role=include]
OUTPUT
$ gcc -Wall tolower.c
$ ./a.out
tolower(A) = a
tolower(B) = b
tolower(C) = c

VARIANT _tolower

#define _tolower(c) ((c) - 'A' + 'a')
DESCRIPTION

The above _tolower macro is a simpler version of tolower that can be used when c is known to be an uppercase character.

RETURN VALUE

The _tolower macro returns a lowercase character.

EXAMPLE
link:src/tolower2.c[role=include]
OUTPUT
$ gcc -Wall tolower2.c
$ ./a.out
Aa