I am trying to search through an array, and only check specific values (the 4th,5th and so on)- ((0+n*4) and (3+n*4). The first one found will be checked and if it has a value of 0 will it be changed to 1 and then the program should stop. If not it will try the next value and so on.. I have the following code, but it doesn't stop ..it makes all the values 1 at once.. Any suggestions?
{
for (i=0; i<(totalnumber); i++)
{ for (n=0; n<((totalnumber)/4); n++)
{ if (i==(0+(n*4)))
{ if (array[i]==0)
{
array[i]=1;
break;
}
}
else if ((i==(3+(n*4))))
{
if (array[i]==0)
{
array[i]=1;
break;
}
}
}
}
}