Question: Objective The next challenge uses getchar ( ) to get user input and make selections from a menu. getchar ( ) Info The getchar (

Objective
The next challenge uses getchar() to get user input and make selections from a menu.
getchar() Info
The getchar() function gets a single character from standard input.
It returns an unsigned char (or in most instances basically a char) containing the entered value.
NOTE: If the user input is terminated with an enter, the enter gets caught in the buffer. So, it is necessary to follow up the getchar() with another to clear the enter out of the buffer.
Steps to Complete
Modify the provided code according to the CODE: comments
Write a user test 4.1 that tests the insert function call
Write a user test 4.2 that tests for "Error entry not in the list" when an invalid choice is made
Run /challenge/tester and get your flag.
HINT: If the code relies on a switch statement, the options. Then for 0 it will need separate functionality to exit the loop, an if (ch=='0') after the switch will work. This is necessary because a break from inside the switch is absorbed by it and does not exit the loop.

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 Programming Questions!