​push_swap /
include / stack.h
162 commits
02-05-2026
35 lines 1.4 kB
 1/* ************************************************************************** */
 2/*                                                                            */
 3/*                                                        :::      ::::::::   */
 4/*   stack.h                                            :+:      :+:    :+:   */
 5/*                                                    +:+ +:+         +:+     */
 6/*   By: mleitao <mleitao@student.42.fr>            +#+  +:+       +#+        */
 7/*                                                +#+#+#+#+#+   +#+           */
 8/*   Created: 2026/04/21 23:34:55 by mleitao           #+#    #+#             */
 9/*   Updated: 2026/05/02 15:26:14 by mleitao          ###   ########.fr       */
10/*                                                                            */
11/* ************************************************************************** */
12
13#ifndef STACK_H
14# define STACK_H
15
16# include "types.h"
17
18/* lifecycle */
19int		stack_init(t_stack *s, int capacity);
20int		stack_build(t_stack *s, const int *values, int capacity);
21void	stack_free(t_stack *s);
22
23/* query */
24int		stack_size(const t_stack *s);
25int		stack_is_empty(const t_stack *s);
26int		stack_at(const t_stack *s, int i);
27int		stack_is_sorted(const t_stack *s);
28
29/* ops */
30void	stack_push(t_stack *dst, t_stack *src);
31void	stack_swap(t_stack *s);
32void	stack_rotate(t_stack *s);
33void	stack_rev_rotate(t_stack *s);
34
35#endif