I'm relatively new to programming and I have to write a function that reads in input from the user and to fill two arrays then compare them. I guess what I'm confused on is how to read in both arrays.
This is what I'm supposed to do,
Write a table_diff fuction that compares two arrays of integers and returns the subscript of the first place they differ. If the arrays are the same, the function should return -1 ex:
345 & 345 --> -1 (same)
345 & 346 --> 2 (differ at index 2)
1234 & 123 --> 3 (differ at index 3)
This is what i have, any help is appreciated!
while((r = scanf("%i", &value)) != 1 && ptra < endptra)
{
*ptra ++ = value;
if (r==1)
printf("No room after reading values\n\n");
else if(r != EOF)
printf("invalid char");
}
while((r = scanf("%i\n", &value))!= 1 && ptrb < endptrb){
*ptrb ++ = value;
if (r==1)
printf("No room after reading values\n\n");
else if(r != EOF)
printf("invalid char");
}