1 /* Type something ... and I tell you it's length! */
5 char first[100]; /* string for firstname */
6 char last[100]; /* etc. */
7 char full[200]; /* string for the full name */
8 char line[4]; /* string for age */
9 int age; /* variable for Age */
13 printf(" -----------------------------------------------------------\n");
14 printf("Yoh dude, ready to let me count...:\n");
16 printf("Enter first name: ");
17 fgets(first, sizeof(first), stdin);
18 first[strlen(first) - 1] = '\0';
20 printf("now the last name : ");
21 fgets(last, sizeof(last), stdin);
22 last[strlen(last) - 1] = '\0';
24 printf("...and your age: ");
25 fgets(line, sizeof(line), stdin);
26 sscanf(line ,"%d" ,&age);
32 printf("%s got %d cHaRaCtErS man!\n", full, strlen(first) + strlen(last) - 2); /* -- \0 must not be counted -- */
33 printf("...and you are %d years old!\n",age );