TheAlgorithms-C/data_structures/stack
Sahil Kandhare e278f5d74f
feat: add Dynamic Stack implementation (#1261)
* Create dynamic_stack.c

In this implementation, functions such as PUSH, POP, PEEK, show_capacity, isempty, and stack_size are coded to implement dynamic stack.

* Update dynamic_stack.c

Worked on Suggested Changes.

* Update dynamic_stack.c

Worked on suggested changes.

* Update dynamic_stack.c

* Update: Used Int type that are OS-independent

---------

Co-authored-by: David Leal <halfpacho@gmail.com>
2023-06-08 08:56:26 -06:00
..
stack_linked_list
dynamic_stack.c feat: add Dynamic Stack implementation (#1261) 2023-06-08 08:56:26 -06:00
main.c chore: add display() and improve code formatting (#975) 2022-11-11 13:53:44 -06:00
parenthesis.c
README.md
stack.c
stack.h

Simple generic Stack

This is a modular generic stack data-structure. The stack is self growing.

Content

  • stack-Header file for import.
  • stack.c implementation of the stack
  • main.c framework program for testing.
  • stack_linkedlist: Another stack implementation by linkedlist

You need to only import the stack.h

Public interface

void initStack();

Initializes the stack with a capacity of 10 elements.

void push(void * object);

pushs the argument onto the stack

void  * pop();

pop: pops the top element of the stack from the stack.

assumes: stack not empty.
int size();

gets the number of elements of the stack.

int isEmpty();

returns 1 if stack is empty otherwise 0.