Skip to content

Instantly share code, notes, and snippets.

@ibeauregard
Last active April 24, 2021 11:26
Show Gist options
  • Save ibeauregard/14edaf65482d7e20a4c2ec9ce676e081 to your computer and use it in GitHub Desktop.
Save ibeauregard/14edaf65482d7e20a4c2ec9ce676e081 to your computer and use it in GitHub Desktop.
/* int_stack.c */
#include "int_stack.h"
static void push(IntStack* this, int value); // function declarations
static int pop(IntStack* this);
static int peek(IntStack* this);
static bool is_empty(IntStack* this);
static void delete(IntStack** this);
IntStack* new_stack()
{
IntStack* this = malloc(sizeof (IntStack));
this->top = NULL;
this->push = &push;
this->pop = &pop;
this->peek = &peek;
this->isEmpty = &is_empty;
this->delete = &delete;
return this;
}
// struct int_node definition
// Function definitions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment