I want to break the inner loop and increase the value of x
if I find something at Matrix[x][y]
but if I break in the y for loop
it will just increase the value at y loop
and not in the x loop
.
int matrix[5][5]; //let's assume there are values inside
for(int i = 0; i < 5; i++)
{
for(int j = 0; j<5;j++)
{
int radius = 1;
for(int x = radius - 1; x <= radius + i; x ++)
{
for(int y = radius -1; y <= radius +j; y++)
{
if((x+i) >= 0 && (y+j)>=0)
{
//for example I find the number 45 in the matrix, then the search radius should be increased by 1 and start it over again.
if(matrix[x][y] == 45)
{
radius++;
break; // but if i break here the x value wont be changed
}
}
}
}
}