Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C language /* This driver program should be used to test your functions defined in the following file: array_utils.c Please note that, this driver program

C language

image text in transcribedimage text in transcribed

/* This driver program should be used to test your functions defined in the following file: array_utils.c Please note that, this driver program is meant for testing your program locally. In the command prompt, type "gcc -o arrayTestDriver arrayTestDriver.c array_utils.c" to create the driver program. Then type "./arrayTestDriver" to see the output. After successful local testing, you MUST test your program (array_utils.c) via webgrader. Also, don't submit this driver program in webhandin. */

#include #include #include #include "array_utils.h"

int main(){ int arr1[] = {1,2,3,3,3,3,3,4,5}; int arr2[] = {2,6,8,11,12,14,15,16}; int arr3[] = {3,8,11,12,14,23,32,33,35}; int arr4[] = {4,8,9,17,23,23,25,29,31}; int arr5[] = {2,4,7,8,9,11,13}; int arr6[] = {3,8,9,11,13};

//test case 1 int result1 = dotProduct(arr4,3,arr5,3); int result2 = numPrime(arr3,9); int *result3 = arrayDifference(arr1,arr2,5,5); int *result4 = arrayIntersect(arr2,arr3,5,5); //test case 2 int result5 = dotProduct(arr1,3,arr2,3); int result6 = numPrime(arr5,4); int *result7 = arrayDifference(arr4,arr5,5,5); int *result8 = arrayIntersect(arr4,arr5,5,5); //test case 3 int result9 = dotProduct(arr2,3,arr3,3); int result10 = numPrime(arr6,5); int *result11 = arrayDifference(arr5,arr6,3,3); int *result12 = arrayIntersect(arr2,arr3,5,5); int i = 0; printf(" Test Case 1:"); for ( i = 0; i 3. In this exercise vou will write several functions that operate on arravs You will place all the function prototypes in a header file named array_utils.h with their definitions in a source file named array_utils.c. You should test your functions by writing a driver program, but you need not hand it in. (a) The dot product of two arrays are a a1, a2, ag, .., an and b-[bi, b2, b3,.., bn] is Write a function that computes the dot product of the two arrays int dotProduct(const int *a, int size, const int *b, int size2); (b) Write a function that takes an integer array and returns the number of integers that are prime in the array int numPrime(const int *a, int size)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Students also viewed these Databases questions

Question

Frame messages for your audiences

Answered: 1 week ago