logo CodeStepByStep logo


Language/Type: C arrays double
Author: Cynthia Lee (on 2016/10/02)

Write a function named findPairs 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 findPairs(arr1, 3, arr2, 5) returns 6. You may assume that each size given as input accurately represent the size of its array.

Type your C solution code here:

This is a function problem. Write a C function as described. Do not write a complete program; just the function(s) above.

You must log in before you can solve this problem.

Log In

Need help?

If you do not understand how to solve a problem or why your solution doesn't work, please contact your TA or instructor.
If something seems wrong with the site (errors, slow performance, incorrect problems/tests, etc.), please

Is there a problem? Contact a site administrator.

© Marty Stepp, all rights reserved.