
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Microsoft C 6.0 - <b>toupper() convert 'c' to uppercase, if appropriate (macro)</b>
[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
toupper() Convert 'c' to Uppercase, if Appropriate (Macro)
#include <ctype.h>
int toupper(c);
int c; Character to be converted
toupper() is a macro that converts 'c' to uppercase. The conversion
is made if 'c' is a lowercase letter; if not, 'c' remains unchanged.
Returns: The converted character 'c'; no error return.
Notes: toupper() is a macro, but the library contains a function
version (declared in <stdlib.h>) because the macro
toupper() does not correctly handle 'c' arguments with
side effects. To use the function version, remove the
definition of toupper() from <ctype.h> with #undef or do
not include the header <ctype.h>.
-------------------------------- Example ---------------------------------
The following statements convert the characters in 'string' to
uppercase before printing them out.
#include <ctype.h>
#include <stdio.h>
char string[15] = "Alphabet Soup";
int x;
main()
{
for (x = 0; x < strlen(string); x++)
printf("%c",toupper(string[x]));
printf("\n");
}
See Also: isupper() islower() _toupper()
Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson