Question: Task 1: write a function that when passed an array of integers returns the index of the smallest integer in the array. Int FindSmallestInt(int array[],

Task 1:

write a function that when passed an array of integers returns the index of the smallest integer in the array.

Int FindSmallestInt(int array[], int size)

function returns the index of the smallest element in the array.

Task 2:

Swap function: this will take as argument the array, its size and two index values. The function will swap values at the two indexes.

Task 3:

Use the two functions from task 1 and 2 for task 3.

You are to hard code an integer array of size 20 with jumbled integer values. To start with the whole array is unsorted.

Find smallest integer in the remaining unsorted array.

Swap it with the the first element of the unsorted array.

Repeat from step 3 from the next index where the smallest was integer was swapped.

When will you stop repeating these steps? When should your function end?

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!