#include /* compute string length */ /* for illustration purposes only since there is a library function strlen */ int length1(char s[]) { int count = 0; while (s[count] != '\0') ++count; return count; } int main(void) { char s[100]; printf("enter a line of input\n"); fgets(s, sizeof(s), stdin); printf("length is %d\n", length1(s)); return 0; }