forked from chozeur/minishell
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathis_num.c
29 lines (26 loc) · 1.08 KB
/
is_num.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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* is_num.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: flcarval <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/07/11 16:51:35 by tbrebion #+# #+# */
/* Updated: 2022/07/30 07:51:17 by flcarval ### ########.fr */
/* */
/* ************************************************************************** */
#include "../../include/minishell.h"
int is_num(char *str)
{
int i;
i = 0;
if (str[i] == '-' || str[i] == '+')
i++;
while (str[i])
{
if (str[i] < 48 || str[i] > 57)
return (0);
i++;
}
return (1);
}