Chapter Contents |
Previous |
Next |
toupper |
Portability: | ISO/ANSI C conforming, UNIX compatible |
SYNOPSIS | |
DESCRIPTION | |
RETURN VALUE | |
IMPLEMENTATION | |
EXAMPLE | |
RELATED FUNCTIONS | |
SEE ALSO |
SYNOPSIS |
#include <ctype.h> int toupper(int c);
DESCRIPTION |
toupper
translates a lowercase character
c
to the
corresponding uppercase character. The argument must either be a
char
value or
EOF
. The mapping
of lowercase to uppercase characters is locale dependent.
RETURN VALUE |
IMPLEMENTATION |
toupper
is implemented by the compiler as a built-in function, unless you use the
name
toupper
with
#undef
.
EXAMPLE |
#include <ctype.h> #include <stdio.h> #define MAX 40 main() { char *str, *ptr; char input[MAX]; puts("Enter a string of lowercase characters (maximum of 40):"); str = gets(input); ptr = str; /* Translate all lowercase characters in a string to */ /* uppercase characters. */ while (*str) { *str = toupper(*str); /* Increment outside of macro for maximum portability. */ str++; } printf("%s\n", ptr); }
RELATED FUNCTIONS |
isupper
,
memupr
,
strupr
,
tolower
SEE ALSO |
Chapter Contents |
Previous |
Next |
Top of Page |
Copyright © 2001 by SAS Institute Inc., Cary, NC, USA. All rights reserved.