I have this practice exercise here. When I type in a sentence with a number of spaces, I expect it to tell me that number. However, it will only say 0 spaces. Am I making one small stupid mistake?
#include <stdio.h>
#include <ctype.h>
#define COUNT 40
int main()
{
char input[COUNT];
printf("Enter a sentence: ");
scanf("%s", input);
int loopCount;
int spaceCount = 0;
for(loopCount = 0; loopCount < COUNT; loopCount++)
{
if (isspace(input[loopCount]))
{
spaceCount++;
printf("SO MUCH STUFF");
}
else{}
}
printf("That sentence has %d spaces.", spaceCount);
return(0);
}