Question: Consider the C library function char * strtok ( char * str, const char * delimiters ); This function stores the starting address of the
Consider the C library function
char * strtok ( char * str, const char * delimiters );
This function stores the starting address of the next token to parse in a static local variable. The objective of this assignment is to appreciate the issues associated with using static local variables.
Write a C program to determine the average number of words per line by using strtok. You will write a function that does the following:
1. tokenizes a string containing multiple sentences into individual sentences (using strtok);
2. calls another function that returns the number of words in a sentence by tokenizing the string containing a sentence into individual words; and
3. calculates the average number of words per sentence.
Test your functions on the preamble of the U.S.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
