Is there a good example of how toupper() works?
Eric "The Mentat Philosopher" Hendrickson
edh at ux.acs.umn.edu
Wed Oct 17 04:29:21 AEST 1990
Basically, what I want to do is take a string of upper/lower case, and make
it all upper case. Here is a first try at it,
#include <ctype.h>
main()
{
char *duh = "Hello";
printf("%s\n", duh);
while (*duh <= strlen(duh)) {
if (islower(*duh)) *duh = toupper(*duh);
*duh++;
}
printf("%s\n", duh);
}
And what I get is :
Hello
Hello
What I want is:
Hello
HELLO
Can anybody point out a good way of doing this?
Thanks much,
Eric Hendrickson
--
/----------"Oh carrots are divine, you get a dozen for dime, its maaaagic."--
|Eric (the "Mentat-Philosopher") Hendrickson Academic Computing Services
|edh at ux.acs.umn.edu The game is afoot! University of Minnesota
\-"What does 'masochist' and 'amnesia' mean? Beats me, I don't remember."--
More information about the Comp.lang.c
mailing list