piscine-rush01/ex00/get_cur_pos.c

35 lines
1.1 KiB
C

/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* get_cur_pos.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: smatthes <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/03/26 21:56:39 by smatthes #+# #+# */
/* Updated: 2023/03/26 22:49:45 by smatthes ### ########.fr */
/* */
/* ************************************************************************** */
void get_cur_pos(int **board, int *pos, int n)
{
int i;
int j;
i = -1;
j = -1;
while (++i < n)
{
while (++j < n)
{
if (board[i][j] == 0)
{
pos[0] = i;
pos[1] = j;
return ;
}
}
j = -1;
}
return ;
}