-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathset_min_max.c
More file actions
30 lines (27 loc) · 1.16 KB
/
set_min_max.c
File metadata and controls
30 lines (27 loc) · 1.16 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
/* ************************************************************************** */
/* */
/* :::::::: */
/* set_min_max.c :+: :+: */
/* +:+ */
/* By: lorenasmienk <lorenasmienk@student.coda +#+ */
/* +#+ */
/* Created: 2019/12/26 12:55:58 by lorenasmien #+# #+# */
/* Updated: 2020/01/03 15:15:04 by lsmienk ######## odam.nl */
/* */
/* ************************************************************************** */
#include "push_swap.h"
void set_min_max(t_stack *ar, int range)
{
int i;
i = ar->len - range;
ar->max = -2147483648;
ar->min = 2147483647;
while (i < ar->len)
{
if (ar->stack[i] > ar->max)
ar->max = ar->stack[i];
if (ar->stack[i] < ar->min)
ar->min = ar->stack[i];
i++;
}
}