-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcount_x_y.c
39 lines (36 loc) · 1.27 KB
/
count_x_y.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
38
39
/* ************************************************************************** */
/* */
/* :::::::: */
/* rush02.c :+: :+: */
/* +:+ */
/* By: zabbas <marvin@codam.nl> +#+ */
/* +#+ */
/* Created: 2019/08/24 18:38:34 by zabbas #+# #+# */
/* Updated: 2019/08/24 18:38:35 by zabbas ######## odam.nl */
/* */
/* ************************************************************************** */
#include "header.h"
int* count_xy(char *str)
{
int height = 0;
int i = 0;
int len = 0;
int *array;
array = malloc(sizeof(int) * 2);
while (str[i] != '\n')
{
i++;
len = i;
}
while (str[i] != '\0')
{
if ( str[i] == '\n')
{
height++;
}
i++;
}
array[0] = len;
array[1] = height;
return (array);
}