piscine-rush01/ex00/get_cur_pos.c

34 lines
1.2 KiB
C

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