Arrays in C Implement a function that finds the smallest and the largest elements in an integer array of n elements, and

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

Arrays in C Implement a function that finds the smallest and the largest elements in an integer array of n elements, and

Post by answerhappygod »

Arrays in C
Implement a function that finds the smallest and the largest
elements in an integer array of n elements, and
swaps them.
For
example, array = {1, 2, 3} and n = 3,
after calling the function
the array becomes array = {3, 2, 1}.
Arrays In C Implement A Function That Finds The Smallest And The Largest Elements In An Integer Array Of N Elements And 1
Arrays In C Implement A Function That Finds The Smallest And The Largest Elements In An Integer Array Of N Elements And 1 (16.06 KiB) Viewed 48 times
/**
* \brief Finds the maximum and the minimum value of an
array composed of n elements
* and swaps them.
*
* \details The function finds the maximum and minimum
element in the argument
* array, and then swaps
them.
*
* For example, array =
{1, 2, 3} and n = 3, after calling the function
* array = {3, 2, 1}.
*
* \param array An array of n integer elements
* \param n The number of elements in array
*
* \note A function for swapping two values is provided
above.
*
* \note In your implementation, do not write to stdout to
check the functionality.
* You should use my_tests function to
print and check the functionality
* of your implementation.
*/
void swap_min_max(int* array, unsigned int n)
{
//TODO: implement your function here!
}
Arrays in C Implement a function that finds the smallest and the largest elements in an integer array of n elements, and swaps them. For example, array = {1, 2, 3} and n = 3, after calling the function the array becomes array = {3, 2, 1}. Hint A function for swapping two values is provided in the template.
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply