Hello,
I'm working on a litle program. While working I stumbeled upon some problems. I would like to check if two Arrays are equal to each other.
I tried this one, but it didn't work properly.
int control(int x1,int y1,int x2, int y2)//x1,y1 and x2,y2 -> coordinates of a location in array
{
int a,x,y = 0;
char safer[3][3];
char oldsafer[3][3];
for(y=0;y<=2;y++) //setting all the values of array safer to zero.
{
for(x=0;x<=2;x++)
{
safer[x][y]=0;
}
}
if(((x1||y1||x2||y2)<=2)&&((x1||y1||x2||y2)>=0)) //the coordinates have to be between 0 and 2,
{ if (safer[x1][y1] == safer[x2][y2])//the coordinates should not be equalto each other
{ if (oldsafer == safer) //if arrays are equal oldsafer = safer
oldsafer = safer;
else // if any of the statements above is wrong a would become 0;
a=0;
}
else
a=0;
}
else
a=0;
return(a); //returning a, if the function returns 0 an error message is going to apear.
}
I hope you understand my problem. otherwhise ask me.