-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathintcheck.c
37 lines (35 loc) · 1.22 KB
/
intcheck.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* intcheck.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: yst-laur <[email protected] +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/03/09 14:16:59 by yst-laur #+# #+# */
/* Updated: 2022/03/09 14:17:10 by yst-laur ### ########.fr */
/* */
/* ************************************************************************** */
#include "push_swap.h"
int intcheck(char **str)
{
int i;
int j;
i = 0;
j = -1;
while (str[++i])
{
while (str[i][++j])
{
if (str[i][j] < '0' || str[i][j] > '9')
{
if (str[i][j] != '-')
return (0);
if (str[i][j] == '-' && (str[i][j + 1] < '0' ||
str[i][j + 1] > '9'))
return (0);
}
}
j = -1;
}
return (1);
}