Algorithms_in_C 1.0.0
Set of algorithms implemented in C.
Loading...
Searching...
No Matches
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);
void push(struct Stack *p, char ch)
push function
Definition infix_to_postfix.c:55

pushs the argument onto the stack

void * pop();
char pop()
Function to pop from the stack.
Definition infix_to_postfix2.c:45

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();
uint16_t isEmpty()
Function to check whether the stack is empty or not.
Definition infix_to_postfix2.c:61

returns 1 if stack is empty otherwise 0.