boot.dev lesson answers for the course: Learn Memory Management in C
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

14 lines
332 B

#pragma once
#include <stddef.h>
typedef struct Stack {
size_t count;
size_t capacity;
void **data;
} my_stack_t; // NOTE: renamed due to std naming conflict on macOS
my_stack_t *stack_new(size_t capacity);
void stack_push(my_stack_t *stack, void *obj);
void *stack_pop(my_stack_t *stack);
void stack_free(my_stack_t *stack);