HP C A.06.05 Reference Manual

Statements
while
Chapter 6 183
while (*ptr_to_a_string++)
count++; /* A simple statement loop */
printf("The string contains %d characters.\n", count);
printf("The first word of the string is ");
while (a_string[count2] != ' ' && a_string[count2] != '\0')
{
/* A compound statement loop */
printf ("%c", a_string[count2]);
count2++;
}
printf("\n");
}
If you execute this program, you get the following output:
Enter a string Four score and seven years ago
The string contains 30 characters.
The first word of the string is Four