push_swap/src/util/stack_max.c
2024-11-07 17:28:58 +01:00

30 lines
1.1 KiB
C

/* ************************************************************************** */
/* */
/* ::: o_ :::::: ::: */
/* stack_max.c :+: / :+::+: :+: */
/* +:+ > +:++:+ +:+ */
/* By: whaffman <whaffman@student.codam.nl> +#+ +:+ +#++#++:++#++ */
/* +#+ +#+#+ +#++#+ +#+ \o/ */
/* Created: 2024/11/07 16:29:41 by whaffman #+#+# #+#+# #+# #+# | */
/* Updated: 2024/11/07 16:36:40 by whaffman ### ### ### ### / \ */
/* */
/* ************************************************************************** */
#include "libft.h"
int stack_max(t_list *lst)
{
int n;
n = *(int *) lst->content;
while (lst->next)
{
if (*(int *) lst->content > n)
n = *(int *) lst->content;
lst = lst->next;
}
if (*(int *) lst->content > n)
n = *(int *) lst->content;
return (n);
}