On this page
tolower
Prev: isspace | Up: ctype.h | Next: errno.h
Rel: ctype.h, Arrays & C Strings
Ref: cppreference — tolower
Tags: #public #prog #c #stdlib #ctype #tier/core
Include
#include <ctype.h>
Signature & Overview
int tolower(int ch); /* also toupper */
Converts an uppercase character to lowercase.
Notes & Pitfalls
- Always cast
(unsigned char)c: Leaves non-uppercase characters unchanged.
Example
#include <assert.h>
#include <ctype.h>
int main(void) {
assert(tolower((unsigned char)'A') == 'a');
assert(tolower((unsigned char)'!') == '!');
}
Linked from
Related notes
- tuts/c/stdlib/ctype/isspace Linked here; links to this page; shared tags: #c, #ctype, #prog, #stdlib, #tier
- tuts/c/stdlib/ctype Linked here; links to this page; shared tags: #c, #ctype, #prog, #stdlib
- tuts/c/stdlib/errno Linked here; shared tags: #c, #prog, #stdlib
- tuts/c/fundamentals/arrays_and_strings Linked here; shared tags: #c, #prog
- tuts/c/stdlib/ctype/isalpha shared tags: #c, #ctype, #prog, #stdlib, #tier
- tuts/c/stdlib/ctype/isdigit shared tags: #c, #ctype, #prog, #stdlib, #tier
- tuts/c/stdlib/assert/assert shared tags: #c, #prog, #stdlib, #tier
- tuts/c/stdlib/assert/static_assert shared tags: #c, #prog, #stdlib, #tier
- tuts/c/stdlib/errno/errno shared tags: #c, #prog, #stdlib, #tier
- tuts/c/stdlib/limits/CHAR_BIT shared tags: #c, #prog, #stdlib, #tier