I am having trouble writing a program that counts the amount of th's in an inputted text. I think I have the right code, but I keep getting an error saying that left operand must be an l-value. This would be in the else-if block (thisChar = 'h').
here is my code.
Code:
int numThs = 0;
char thisChar, lastChar = ' ';
while (scanf("%c", &thisChar) != EOF){
if (scanf("%c", &thisChar) == 1){
if (thisChar = 't')
lastChar = thisChar;
else if (thisChar = 'h' && lastChar = 't')
numThs++;
}
}
printf("There were %d th's.\n", numThs);
thanks for any help.