Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

IN C LANGUAGE 1) Prompt the user to enter a sentence 2) read in AT MOST 80 characters of the sentence the user entered 3)

IN C LANGUAGE

1) Prompt the user to enter a sentence 2) read in AT MOST 80 characters of the sentence the user entered 3) call function parseInput that will go through the input looking for a space and create pointers to each character after the space 4) print out the number of words in the sentence (that was at most 80 characters) and the characters that the pointers reference

The idea:

User inputs: A long sentence that will get us started on the lab so that we can see what is really going on here

Your code should only read in A long sentence that will get us started on the lab so that we can see what is r

And build an array of pointers to characters count the number of words and print out each word via a pointer to the word: The 80 characters read were: A long sentence that will get us started on the lab so that we can see what is r There were 19 words and the starting letters of the words were: A l s t w g u s o t l s t w c s w i r

IN C LANGUAGE

#include #include #include

#define BUFFERSIZE 81 // 80 characters plus end of string

int parseInput(char userInput[], char *ptrsToChars[]){

// your code goes in here to find the spaces and count the words and put pointers to characters after the spaces into ptrsToChars // when your function is done, ptrsToChars[0] should have address of first character in first word in userInput // and ptrsToChars[i] should have the address of the first character of word i

return 0; // this should return the number of words in userInput }

int main (int argc, char *argv[]) { char userInput[BUFFERSIZE]; // Buffer to hold user input char *ptrsToChars[BUFFERSIZE]; // array to hold pointers to characters in the above buffer // read in user input here

// call parseInput here

// write code to display results from parseInput return 0; }

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Murach's SQL Server 2012 For Developers

Authors: Bryan Syverson, Joel Murach, Mike Murach

1st Edition

1890774693, 9781890774691

More Books

Students also viewed these Databases questions