my code counts the number of letters from the given string(excluding white space). cs50.h is a library which consists of get_string()
function which takes input from user. the code is compiling but when i give an input which has more than one word, it stops working(doesn't give me anything).can anyone please tell why?(i am using c language)
#include <cs50.h>
#include <stdio.h>
#include <ctype.h>
int count_letters(string text);
int main(void)
{
string input = get_string("Text: ");
int letters = count_letters(input);
printf("%i\n",letters);
}
int count_letters(string text)
{
int i = 0;
while(text[i] != '\0')
{
if(isspace(text[i]))
continue;
i++;
}
return i;
}