Implement the function with this signature:
void large_and_small(const int* array, int length, int* largest, int* smallest)
Call this function with an array of integer values. It should find the smallest and the largest values in this array and place them in the largest and smallest variables. The length parameter is the length of the array being passed -- calculate this length before passing it, don't hard- code it. Use pointer arithmetic, not subscripting, to work with your array. Print the result of the call.
Testing
Test your function with the following arrays:
[72,90,100,36,21,15,76,-6,63,41,99,27,3,66,19,16,27,47,0,23]
[-72,-90,-100,-36,-21,-15,-76,-6,63,41,99,27,3,66,19,16,27,47,0,23]
Capture the output of each of these operations and paste them into a text file in your project named ps2results.txt.
Implement the function with this signature:
double inner_product(const double* leftArray, const double* right_array, int length)
This function takes two arrays of length length and returns the inner product
( a[0] * b[0] )+ ( a[1] * b[1] ) + ... + ( a[length -1] * b[length -1] )
You may not use array subscripts, only pointer arithmetic. Print the result of the call. You should check that the lengths are the same before making the call.
Testing
Test your function with the following arrays:
left: [15.26, 28.20, 6.71, 72.22, 92.85, 15.50, 85.64, 57.41, 44.40, 72.91]
right: [9.17, 4.8, 10.9, 10.12, 17.18, 3.9, 6.19, 5.4, 3.13, 6.1]
Capture the output of each of these operations and paste them into a text file in your project named ps2results.txt.
Implement the function with the following signature:
bool compareArrays(int* left, int left_length, int* right, int right_length)
Return true if the arrays have identical values or false if they do not. You should first test whether the arrays have equal length, since if they don't, they can't be equal.
You may not use array subscripts, only pointer arithmetic. Print the result of the calls.
Testing
Test your function with the following arrays:
left: [72, 90,100,36,21,15,76,-6,63,41,99,27,3,66,19,16,27,47,0,23]
right: [72, 90,100,36,21,15,76,-6,63,41,99,27,3,66,18,16,27,47,0,23]
left: [72, 90,100,36,21,15,76,-6,63,41,99,27,3,66,19,16,27,47,0,23]
right: [72, 90,100,36,21,15,76,-6,63,41,99,27,3,66,18,16,27,47,23]
Capture the output of each of these operations and paste them into a text file in your project named ps2results.txt.