So i am trying to make a matching game in which there is an array which is scrambled. Is there a way to "check for a match" between two numbers in the array? For example, is what ever number in position 2 equal to what ever number in position 7?
if you want to check the whole array for matches, use a nested do loop like this
int nmbrMatches = 0;
int i, j;
for (i = 0; i < arraySize; i++)
{
for (j = i+1; j++; j < arraySize if( array == array[j]) nmbrMatches++; } That will find all matches. If you want to stop at the first match, use an exit.