0

How does [POINTS[word[i]] work, I don't seem to get it, somehow I got it to work, but many times it is showing incompatible comparison between type int and char.

1
  • please show the complete line of code and please format the code as code
    – UpAndAdam
    Aug 25, 2023 at 13:46

2 Answers 2

1

The problem is that word is a string and that indices of word are char's not int's and POINTS is an array of int's. You need to do something to the result of word[i] to turn it into an integer, where a or A gets you the value of 0 and so forth for all the other letters. You have several options, one thing they point out is to potentially use islower or isupper functions which will return true if the variable passed to them is lower case or upper case respectively.

0

I recommend to use the new ddb tool (the duck): you can ask it the questions you have, in the context of your code, and it generally gives pretty accurate and detailed answers. He is like a virtual assistant of David Malan!

You must log in to answer this question.

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