I keep getting this error for my switch statement when I compile it:
"scrabble.c:50:9: error: statement requires expression of integer type ('string' (aka 'char *') invalid) switch (word) ^ ~~~~ fatal error: too many errors emitted, stopping now [-ferror-limit=]"
#include <ctype.h>
#include <cs50.h>
#include <stdio.h>
#include <string.h>
// complete the compute_score function
// return the number of points for the word
// ignore non-letter words
// handle both upper-case and lower-case letters
// in main, Print: "player 1 wins!" or "player 2 wins!" or "Tie!".
// Points assigned to each letter of the alphabet
int POINTS[] = {1, 3, 3, 2, 1, 4, 2, 4, 1, 8, 5, 1, 3, 1, 1, 3, 10, 1, 1, 1, 1, 4, 4, 8, 4,
10};
int compute_score(string word);
int main(void)
{
// Get input words from both players
string word1 = get_string("Player 1: ");
string word2 = get_string("Player 2: ");
// Score both words
int score1 = compute_score(word1);
int score2 = compute_score(word2);
// TODO: Print the winner
if (score1 > score2)
{
printf("Player 1 Wins!\n");
}
else if (score1 < score2)
{
printf("Player2 Wins!\n");
}
else
{
printf("It's a TIE!");
}
}
int compute_score(string word)
{
// TODO: Compute and return score for string
int score = 0;
int length = strlen(word);
for (int i = 0; i < length; i++)
{
switch (word)
{
case isupper(word[i]):
score += Points(word[i] - '65');
Break;
case islower(word[i]):
score += Points(word[i] - '97');
Break;
}
return score;
}
}