Code:
struct list_item {
char data;
struct list_item *next;
}
typedef struct list_item stackItem;
extern stackItem *header;
void create();
void push();
void pop();
int empty ();
not sure if this is all ok. but then my operator class follows:
#include <stdio.h>
#include <alloc.h>
#include "stackhead.h"
stackItem *header;
void create() {
stackItem *newStack;
newStack = (stackItem *) malloc( sizeof(stackItem) );
newStack->data=NULL;
newStack->next=NULL;
};
void push(stackItem **head, char newData) {
stackItem *tempItem;
tempItem = (stackItem *) malloc( sizeof(stackItem) );
tempItem->data = newData;
tempItem->next = *head;
*head = tempItem;
};
void pop(stackItem head) {
*head->next = header;
};
int empty(stackItem **head) {
if (*head == NULL) {
return 1; } else {
return 0;
}
};

