I want to count the number of spaces. As I understand it, compiler sweare at this line isspace(s[step]) != 0. But sometimes the code started and there was no error. I don't know why it is so.
char s[] = "So she was considering";
int number_space = 0, step = 0;
int length_string = strlen(s);
while(strlen(s) != step){
if(isspace(s[step]) != 0){
number_space++;
}
step++;
}
cout << number_space;