i was compiling my code and it gave me this error, with an arrow below the 's'. I don't understand what it means? note: to match this '(' printf("%c", toupper(s[(int)(' ')]i++));

  • 1
    Which exercise or part of the pset was this from? If you could post some screenshots that would help tremendously as well. As is, I doubt many could give an accurate answer for this. Jul 30 '16 at 22:26
  • When you say "this error", it's helpful to cut and paste the error message int the body of your question. Jul 31 '16 at 2:48

Without seeing the actual error message or the related code, this is a problem:

 printf("%c", toupper(s[(int)(' ')]i++));

There is one placeholder in the format string, the %s, but the value to be substituted is ambiguous at best. The combination of toupper(s[(int)(' ')] and i++ is not a valid parameter here. It is two parameters where there should only be one. The problem is further complicated because the parameters aren't separated by a comma, so it just comes out as one bad parameter. It's likely that this has totally confused the compiler, but is still recognized as a problem.

After that, what is your intent with this parameter? It doesn't make any sense to me. The value that you are trying to pass to toupper() is s[(int)(' ')]. This becomes s[32], so whatever is in position 32 (the ASCII code of a space) is what will be passed to the tolower() function. (BTW, the casting as an int isn't necessary. Chars behave like 1 byte unsigned int's already. Also, toupper() has no effect on a space.)

If this answers your question, please click on the check mark to accept. Let's keep up on forum maintenance. ;-)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .