Question: Lab Report 1 : Pointers You are required to implement these requirements in this problem: a . Ask the user to enter the size of

Lab Report 1: Pointers
You are required to implement these requirements in this problem:
a. Ask the user to enter the size of an array in main method. The program should
validate the size of an array, if it is not in between 5 to 50(inclusive), ask the user
to re-enter until it is valid.
b. Write a function named ArrayAllocator that dynamically allocates an array of
integers. The function should accept an integer argument indicating the number
of elements to allocate. The function should return a pointer to the array
c. Call ArrayAllocator in the main function and create an array of the size
provided by the user.
d. Populate the array with random integer numbers 0 to 9 using seed value as
6000 in main method and display the contents of the array.
e. In statistics, the mode of a set of values is the value that occurs most often or
with the greatest frequency. Write a function named FunctionMode that accepts
as arguments an array of integers and an integer that indicates the number of
elements in the array. The function should determine the mode of the array. That
is, it should determine which value in the array occurs most often. The mode is
the value the function should return. If the array has no mode (none of the values
occur more than once), the function should return 1.(Assume the array will
always contain nonnegative values.). You need to use pointer notation and
dynamic memory allocation instead of array notation.
f. Display the mode of the array with its frequency (number of times the mode
value occurred in the array).

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