I have an assigment that basically asks the program to read from a file "data.txt". This file has 50 values. So it is neccesary to make two arrays, the first one should take the first 25 values and the second array should take the remaining 25. Then compare them and give a result when the numbers are the same for the same suscript.
So it needs to read the same value at the same position for each array, that's where i get my problem :/
I get the following for the function (which is what i lack) in order to compare them:
Code:
int equal_arrays(int a1 [], int a2 [], int n)
{
int i, result;
for (i=0; i<n; ++i)
if (a1[i] != a2[i]) result = 0;
else result = 1;
return (result);
}
but.. I have no clue how to compare the arrays so it gives me the number of the one that repeats on both of them. I'm sure that what I've done so far is somewhere close to the end. I've been trying to make it work and think of alot of things but seems that none of them work. Any help would be really appreciated. Thanks in advance.