Question: Write a program in C to find the smallest element using Dynamic Memory Allocation. The program must: 1. Ask the user for the total number

Write a program in C to find the smallest element using Dynamic Memory Allocation. The program must:

1. Ask the user for the total number of elements.

2. Let the user enter the numbers.

3. Create a dynamic array at run-time and store those numbers.

4. Display the entered numbers.

5. Find the smallest one and display it.

Note: Numbers entered by the user can be floating point numbers. Dont forget to check the returned pointer. Before exiting program, you should release the memory space.

Answer Example :

Enter total number of elements: 5

Number 1: 12.3

Number 2: 24.9

Number 3: 77

Number 4: 7.5

Number 5: 30

You have entered: 12.30 24.90 77.00 7.50 30.00

The smallest element is: 7.50

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!