Skip to content

Instantly share code, notes, and snippets.

@ibeauregard
Last active April 3, 2021 15:28
Show Gist options
  • Save ibeauregard/84cb0f169697efd68dc3f7efa4917ec0 to your computer and use it in GitHub Desktop.
Save ibeauregard/84cb0f169697efd68dc3f7efa4917ec0 to your computer and use it in GitHub Desktop.
The main before introducing the destructor
int main()
{
IntStack* stack = new_stack();
for (int i = 5; i > 0; i--) {
push_to_stack(stack, i);
}
printf("At the top of the stack is `%d`\n\n", peek_stack(stack));
while (!is_empty_stack(stack)) {
printf("`%d` was popped from the stack\n", pop_stack(stack));
}
free(stack); stack = NULL;
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment