Question: Reads a character string and counts the existing words */ #include void main() { char line[81], *pline ; int cword =0; printf( Enter a string

Reads a character string and counts the existing words */

#include

void main()

{ char line[81], *pline ;

int cword =0;

printf( Enter a string of characters :);

gets(line);

for (pline=line; *pline == , pline++); // Skips blanks.

while (pline !=\0)

{ cword ++;

for ( ; ((pline !=\0) and ( *pline!= ); pline++) ; // skips letters

for ( ; ((pline !=\0) and ( *pline== ); pline++) ; // skips blanks

}

printf(There are %d words in the string.,cword);

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!