TheAlgorithms-C/data_structures/stack
Anas Khan 00500d6108
chore: add display() and improve code formatting (#975)
added display to view entire stack using for loop and formatted code.
2022-11-11 13:53:44 -06:00
..
stack_linked_list formatting source-code for 5bba04b671 2020-06-28 15:25:37 +00:00
main.c chore: add display() and improve code formatting (#975) 2022-11-11 13:53:44 -06:00
parenthesis.c formatting source-code for 5bba04b671 2020-06-28 15:25:37 +00:00
README.md Add syntax highlight 2020-04-08 18:30:07 +08:00
stack.c formatting source-code for 5bba04b671 2020-06-28 15:25:37 +00:00
stack.h formatting source-code for b388e4a309 2020-05-29 20:23:24 +00:00

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.