toupper() help
Guys,
Thanks in advance for taking the time to help for this.
I have stored a string into a variable lowconv and want to print it to screen in uppercase letters.
char lowconv[25];
gets(lowconv);
puts(toupper(lowconv));
Can someone tell me why this doesn''t work?
for (int i = 0; i < strlen(lowconv); i++)puts(toupper(lowconv[i]));
[edited by - fallenang3l on July 3, 2002 12:13:48 PM]
July 03, 2002 11:20 AM
As far as I know, toupper() takes an int as argument, not a complete string. So you will have to upper (pun intended) every single character. Try looking into the manual?
char lo[25];char up[25];gets(lo);for (i = 0; i <= strlen(lo); i++) up[i] = toupper(lo[i]);puts(up);
To the vast majority of mankind, nothing is more agreeable than to escape the need for mental exertion... To most people, nothing is more troublesome than the effort of thinking.
[edited by - jenova on July 3, 2002 12:59:46 PM]
To the vast majority of mankind, nothing is more agreeable than to escape the need for mental exertion... To most people, nothing is more troublesome than the effort of thinking.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement