Question: Write a function read_list() which prompts for the list of non-negative numbers terminated by -99. Read the non-negative integers into an array which stores integer
Write a function read_list() which prompts for the list of non-negative numbers terminated by -99. Read the non-negative integers into an array which stores integer numbers. The number of elements in the input list may be less than 20. Stop reading when either the input number is the sentinel value -99 or when 20 (valid) numbers have been read into the array. An invalid number( any negative integer) entered will be ignored. The function takes three parameters, the array holding integers, the number of elements stored in the array (which is defined as pass by reference), and maximum size of the array . Define the first two parameters so that they are modifiable. The function does not return any value. If the user only imput negative numbers , print out " The list is empty"
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
