This documentation is copyright © 1998-2001 Sandro Sigala <sandro@sigala.it>.
All rights reserved.

Released under the GNU General Public License.

Return to index Return to header Previous symbol Next symbol

tolower

Prototype

#include <ctype.h>

int tolower(int c);

Description

Returns the lowercase character corresponding to the character c, if the value of isupper with the argument c is true, otherwise returns the c argument unchanged.

Example

View source
#include <ctype.h>

/*
 * Compare the two strings ignoring the characters case.
 */
int istrcmp(const char *s1, const char *s2)
{
    const unsigned char *sp1 = (const unsigned char *)s1;
    const unsigned char *sp2 = (const unsigned char *)s2;

    for (; tolower(*sp1) == tolower(*s2); ++sp1, ++sp2)
	if (*sp1 == '\0')
	    return 0;

    return tolower(*sp1) - tolower(*sp2);
}

References

ISO C 9899:1990 7.3.2.1