-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathft_funcs_1.c
More file actions
77 lines (67 loc) · 1.45 KB
/
ft_funcs_1.c
File metadata and controls
77 lines (67 loc) · 1.45 KB
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_funcs_1.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: disle <disle@student.21-school.ru> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/12/08 16:00:32 by disle #+# #+# */
/* Updated: 2021/12/08 16:00:35 by disle ### ########.fr */
/* */
/* ************************************************************************** */
#include "ft_printf.h"
int ft_strlen(char *str)
{
int i;
i = 0;
while (str[i] != '\0')
i++;
return (i);
}
int ft_intlen(long long int n)
{
int i;
i = 0;
if (n <= 0)
{
n *= -1;
i++;
}
while (n > 0)
{
n = n / 10;
i++;
}
return (i);
}
int ft_hexlen(long int n)
{
int len;
len = 0;
if (n <= 0)
len++;
while (n != 0)
{
n = n / 16;
len++;
}
return (len);
}
int ft_hexlenp(unsigned long int n)
{
int len;
len = 0;
if (n <= 0)
len++;
while (n != 0)
{
n = n / 16;
len++;
}
return (len);
}
int ft_putchar(char c)
{
write(1, &c, 1);
return (1);
}