In C, implement the function that gets an array of ints and its length, and returns the maximum of the absolute values. int max_abs (const int* arr, int len); For example: On input [1, -3, 7, 4] the function should return 7. On input [2, -3, 2, -4] the function should return 4. On input [0, -3, 2] the function should return 3.

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter15: Recursion
Section: Chapter Questions
Problem 8SA
icon
Related questions
Question

In C, implement the function that gets an array of ints and its length, and returns the maximum of the absolute values.

int max_abs (const int* arr, int len);

For example:

  • On input [1, -3, 7, 4] the function should return 7.
  • On input [2, -3, 2, -4] the function should return 4.
  • On input [0, -3, 2] the function should return 3.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning