readability.c:28:9: error: expected expression
else:
Shown above is the error I am getting. If anyone would point me to what exactly I am doing wrong. that would be great. Bellow, I will add my Readability code written so far.
#include <stdio.h>
#include <cs50.h>
#include <math.h>
#include <string.h>
int main(int argc, char *argv[])
{
char *string = get_string("Enter a string:\n");
int i = 0;
int char_count = 0;
int alp = 0;
int word = 0;
int sentance = 0;
while(string[i]!='\0')
{
if((string[i]>='a' && string[i]<='z') || (string[i]>='A' && string[i]<='Z'))
{
alp++;
}
else
{
if ((string[i] = ' ') || (string[i] = '.') || (string[i] = '!') || (string[i] = '?') || (string[i] = ','))
{
word++;
}
}
else
{
if ((string[i] = '.') || (string[i] = '!') || (string[i] = '?'))
{
sentance++;
}
}
i++;
}
printf("%i\n", alp);
printf("%i\n",word);
printf("%i\n",sentance);
}
So the error is somewhere on the line 28. I am assuming my "else" statement syntax is wrong, but considering it is identical to the line above, I can't figure out what is wrong. The code worked just fine before the line 28 was added