Question: Write a program element.c that compares elements of two integer arrays a and b, and stores the elements in array c that are either in

Write a program element.c that compares elements of two integer arrays a and b, and stores the elements in array c that are either in a or in b, but not in both a and b . For example, array a contains elements{1, 2, 3},array b contains elements{3, 2, 6, 7}. Array c shouldcontain{1, 6, 7}.

Your program should include the following function:

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

The function should

use pointer arithmetic

not subscripting

to 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

t

both, and

store

s 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 sixt

h parameter size points to a variable in whi

ch 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.

DO not use dynamic array or any calloc or malloc method.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!