23 lines
1.1 KiB
C
23 lines
1.1 KiB
C
/* ************************************************************************** */
|
|
/* */
|
|
/* ::: :::::::: */
|
|
/* ps_push.c :+: :+: :+: */
|
|
/* +:+ +:+ +:+ */
|
|
/* By: tmaze <tmaze@student.42.fr> +#+ +:+ +#+ */
|
|
/* +#+#+#+#+#+ +#+ */
|
|
/* Created: 2019/02/21 15:59:46 by tmaze #+# #+# */
|
|
/* Updated: 2019/03/06 11:36:38 by tmaze ### ########.fr */
|
|
/* */
|
|
/* ************************************************************************** */
|
|
|
|
#include "push_swap.h"
|
|
|
|
int ps_push(t_psdata *data, char c)
|
|
{
|
|
t_stack *tmp;
|
|
|
|
if ((tmp = ps_stkpop(data, (c == 'a') ? 'b' : 'a')) != NULL)
|
|
ps_stkpsh(data, c, tmp);
|
|
return (tmp != NULL);
|
|
}
|