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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started