Need help with a functions/arrays.
Somewhat a beginner, I'm trying to make a program that separates 50 integer numbers into two separate arrays(with 25 each naturally). I then need to make a function that takes the two numbers and if they are the same returns true, and false otherwise. I also need to find the cell number that they are located in so I made a pointer for that.
Here is the start of my function.
find_same(int check1, int check2, int size, int*loc)
loc = 0;
for(i=0; i<size; ++i)
if(check1[i] == check2[i])
same = check1[i];
*loc = i;
Here is the rest of my program. I've comprehended it as got the numbers from the file, put them into two arrays and sent them to the function and then print the results. Am I missing anything?
int array1, array2, i, samenum, position;
input = fopen("data.txt", "r");
for(i=0; i<25; ++i)
fscanf(input, "%d", &array1[i]);
for(i=1; i<25; ++i)
fscanf(input, "%d", &array2[i]);
samenum = find_same(array1,array2,25,&position);
printf("%d ", samenum);
printf("%d ", position);
Thanks for reading/your help.