Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

void find_elements(int *a, int n1, int *b, int n2, int *c, int*size); The function should use pointer arithmeticnot subscriptingto visit array elements. In other words,

void find_elements(int *a, int n1, int *b, int n2, int *c, int*size);

The function should use pointer arithmeticnot subscriptingto visit array elements. In other words, eliminate the loop index variables and all use of the [] operator in the function.

The find_elements function finds the elements that in either array a or array b, but no both, and stores the result in array c. The function takes an int array parameters a1 and 2 as the first parameter and third parameters and the number of elements of the arrays as the second parameter. The sixth parameter size points to a variable in which the function will store the number of actual elements in array c.

In the main function, ask the user to enter the lengths of the arrays, the array elements, declare the input arrays, and the output array with length as the sum of the lengths of the two input arrays (the actual length will be determined by the find_elements function), and call the function.The main function should display the result.

Example Input/Output:

Enter the length of the first array: 5

Enter the elements of the array: 9 8 5 6 4

Enter the length of the second array: 4

Enter the elements of the array: 6 9 7 1

Output: 8 5 4 7 1

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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

Students also viewed these Databases questions