-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcounters.c
More file actions
57 lines (50 loc) · 1.31 KB
/
counters.c
File metadata and controls
57 lines (50 loc) · 1.31 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* counters.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: ltombell <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/11/03 13:28:47 by ltombell #+# #+# */
/* Updated: 2022/11/09 17:39:24 by ltombell ### ########.fr */
/* */
/* ************************************************************************** */
#include "so_long.h"
int count_coins(char **mappa)
{
int i;
int b;
int res;
res = 0;
i = 0;
while (mappa[i] != NULL)
{
b = 0;
while (mappa[i][b])
{
if (mappa[i][b] == 'C')
res++;
b++;
}
i++;
}
return (res);
}
int count_base(char **mappa)
{
int i;
i = 0;
while (mappa[0][i] != '\n')
i++;
return (i);
}
int count_height(char **mappa)
{
int i;
i = 0;
while (mappa[i] != 0)
{
i++;
}
return (i - 1);
}