Programing C Create a program with two functions, one that scans a sentence and one that prints it out (including white spaces). Your scan function: • Should receive two arguments, the length of the string and the string. • It should not return anything. • It should check if the user inputted more characters than the ones he/she has originally said. • It should stop scanning when the Enter Key is pressed. • Don't forget to leave a spot for the null character. Your print function: • Should only receive one argument; the string. • It should not return anything. Note: Your program may behave weirdly if you aren't careful when scanning. Remember what we discussed regarding scanf(“%d%c", ...);. Add a dummy character at the end, so that it “removes" the enter key that you pressed. Example of both possible outputs: What is the estimated length of your array? 20 Please input your sentence/string/phrase: My name is Mario Esparza. String is longer than the estimated length. You may continue, but your string has been chopped off. We recommend you press control C and start over. The sentence you inputted is: My name is Mario Es What is the estimated length of your array? 20 Please input your sentence/string/phrase: My name is Mario. The sentence you inputted is: My name is Mario.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
Programing C
Create a program with two functions, one that scans a sentence and one that prints it out (including white
spaces).
Your scan function:
• Should receive two arguments, the length of the string and the string.
• It should not return anything.
• It should check if the user inputted more characters than the ones he/she has originally said.
• It should stop scanning when the Enter Key is pressed.
• Don't forget to leave a spot for the null character.
Your print function:
• Should only receive one argument; the string.
• It should not return anything.
Note: Your program may behave weirdly if you aren't careful when scanning. Remember what we discussed
regarding scanf(“%d%c", ...);. Add a dummy character at the end, so that it “removes" the enter key that you
pressed.
Example of both possible outputs:
What is the estimated length of your array? 20
Please input your sentence/string/phrase:
My name is Mario Esparza.
String is longer than the estimated length.
You may continue, but your string has been chopped off.
We recommend you press control C and start over.
The sentence you inputted is:
My name is Mario Es
What is the estimated length of your array? 20
Please input your sentence/string/phrase:
My name is Mario.
The sentence you inputted is:
My name is Mario.
Transcribed Image Text:Programing C Create a program with two functions, one that scans a sentence and one that prints it out (including white spaces). Your scan function: • Should receive two arguments, the length of the string and the string. • It should not return anything. • It should check if the user inputted more characters than the ones he/she has originally said. • It should stop scanning when the Enter Key is pressed. • Don't forget to leave a spot for the null character. Your print function: • Should only receive one argument; the string. • It should not return anything. Note: Your program may behave weirdly if you aren't careful when scanning. Remember what we discussed regarding scanf(“%d%c", ...);. Add a dummy character at the end, so that it “removes" the enter key that you pressed. Example of both possible outputs: What is the estimated length of your array? 20 Please input your sentence/string/phrase: My name is Mario Esparza. String is longer than the estimated length. You may continue, but your string has been chopped off. We recommend you press control C and start over. The sentence you inputted is: My name is Mario Es What is the estimated length of your array? 20 Please input your sentence/string/phrase: My name is Mario. The sentence you inputted is: My name is Mario.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 2 images

Blurred answer
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education