hello every one I have written code
char sentence[100];
scanf("%s" ,sentence);
char * ptrs = sentence ;
printf("%d", strlen(ptrs));
suppose I enter
john is a boy
the strlen() function is giving me value 4 it stops counting after space what I should do
thanks
That scanf will read only one word, if you do a
printfyou will see it. So there is nothing wrong withstrlen.Use
fgetswhich reads a whole line: