Home > Back-end >  Help fill this code
Help fill this code

Time:12-23

Given two same size plastic array, each element in the array are the same, find two array elements in them, calculate and output them and as a result, if there is no common elements, and the result is 0,

Subject you only need to write int sumIdenticalEle (const int * p, const int * q, const int size) and return to a total of two array elements in the function and as a result, namely,//in the location specified, Please do the fill thisblank paste your code, remove and return the line after the return of your results, Please do not modify the program to other parts, the other receives the output, and call in the main function, and sumIdenticalEle function definition in front of the main function, so you don't need to write the input and output, function declarations and calls, the main function and header files as follows:

#include

Int sumIdenticalEle (const int * p, const int * q, const int size)

{//do fillthis blank

Return for money;//subject needs to return and the results

}

Int main ()

{

Int I, j, sum, size;

The scanf (" % d ", & amp; The size);

Int array_1 [size], array_2 [size];

for(i=0; I
The scanf (" % d ", & amp; Array_1 [I]);

for(i=0; I
The scanf (" % d ", & amp; Array_2 [I]);

Sum=sumIdenticalEle (array_1 array_2, size);

Printf (" % d \ n ", sum);

return 0;

}


Input
Three lines, the first behavior is an integer, the array size, line 2 &3, respectively the first and second plastic array, the array elements separated by a space,


The Output
A line, said there are two array elements and as a result,

  • Related