#include <string.h>
#include <stdio.h>
// w ww . j a v a 2 s. co m
int main()
{
char line[100];
printf("Enter a line: ");
fgets(line, sizeof(line), stdin);
printf("The length of the line is: %d\n", strlen(line));
return (0);
}
#include <stdio.h>
// ww w . j a va 2 s. co m
void main() {
char str1[40] = "To be or not to be";
char str2[40] = ",that is the question. ";
int count = 0;
while (str1[count] != '\0')
count++;
printf("\nThe length of the string \"%s\" is %d characters.", str1, count);
count = 0;
while (str2[count] != '\0')
count++;
printf("\nThe length of the string \"%s\" is %d characters.\n", str2, count);
}