I have tried to make a simple program in C to count the number of char in a string. But it only counts the first word, if i leave any space it stops
#include <stdio.h>
int main() {
    char str1[100];
    int i = 0, count = 0;
    printf("enter string:\n");
    scanf("%s", str1);
    while (str1[i] != '\0') {
        i++;
        count++;
    }
    printf("total number of char %d", count);
    return 0;
}
 
    