String as char array case conversion.

How do I write this code to where the program exits even if stop is written in all caps? This is an exercise where I have to correct the code. Perhaps I coudl use a for loop and do a isupper or toupper one by one but I get a sense that is the long way to do it and there is a much easier rout.


1
2
3
4
5
6
7
8
9
10
11
int main()
{ 

	char str[] = "Stop";

if (isupper(str) == "STOP")
		exit(0);
	
	
	
	return 0;}
isupper/toupper only works on one char at a time so you will have to go through each character.
Topic archived. No new replies allowed.