logo CodeStepByStep logo

find_pairs

Language/Type: C arrays double
Author: Cynthia Lee (on 2018/02/03)

Write a function named find_pairs that accepts an array of real numbers (as double[]), its size (as int), and a second array of real numbers (as double[]) and its size (as int). It returns the number of pairs (a, b) that can be made where a is a number from the first array, b is a number from the second array, and a < b. For example, if double arr1[] = {1.0, 2.0, 3.0}; and double arr2[] = {3.0, 2.0, 2.0, 0.0, 3.0};, then the call of find_pairs(arr1, 3, arr2, 5) returns 6. You may assume that each size given as input accurately represent the size of its array.

Function: Write a C function as described, not a complete program.

You must log in before you can solve this problem.

Log In

Need help?

Stuck on an exercise? Contact your TA or instructor.

If something seems wrong with our site, please

Is there a problem? Contact us.