tgrekov-push_swap
HIVE push_swap July 2024
Loading...
Searching...
No Matches
utils.h
1/* ************************************************************************** */
2/* */
3/* ::: :::::::: */
4/* utils.h :+: :+: :+: */
5/* +:+ +:+ +:+ */
6/* By: tgrekov <tgrekov@student.hive.fi> +#+ +:+ +#+ */
7/* +#+#+#+#+#+ +#+ */
8/* Created: 2024/04/22 06:08:01 by tgrekov #+# #+# */
9/* Updated: 2024/07/16 12:08:33 by tgrekov ### ########.fr */
10/* */
11/* ************************************************************************** */
12
20#ifndef UTILS_H
21# define UTILS_H
22
23void **arr_free(void **arr);
24int arr_len(void **arr);
25int err(char *str, int retval);
26int fallback(int a, int b);
27int get_minix(int *arr, int len);
28int wrap_ix(int i, int max);
29
30#endif
void ** arr_free(void **arr)
Free each element in a null-terminated array, and then the array itself.
Definition arr_free.c:29
int arr_len(void **arr)
Count number of elements in a null-terminated array.
Definition arr_len.c:26
int err(char *str, int retval)
Print str to stderr and return retval.
Definition err.c:29
int fallback(int a, int b)
Return a if non-zero, otherwise return b.
Definition fallback.c:27
int get_minix(int *arr, int len)
Get the index of the smallest element.
Definition get_minix.c:27