/* * main.c * * Created on: 2009-1-12 * Author: chen */
#include "Stack.h"
int main(void) { Stack head; head.next = NULL; char *txt1 = (char *)malloc(100); memset(txt1, 0, 100); char *txt2 = (char *)malloc(100); memset(txt2, 0, 100); char *txt3 = (char *)malloc(100); memset(txt3, 0, 100); char *txt4 = (char *)malloc(100); memset(txt4, 0, 100); char *txt5 = (char *)malloc(100); memset(txt5, 0, 100); memcpy(txt1, "aaaaaaaa", 100); memcpy(txt2, "bbbbbbbb", 100); memcpy(txt3, "cccccccc", 100); memcpy(txt4, "dddddddd", 100); memcpy(txt5, "eeeeeeee", 100); push(&head, (void *)txt1); push(&head, (void *)txt2); push(&head, (void *)txt3); push(&head, (void *)txt4); push(&head, (void *)txt5);
Stack *temp = pop(&head); printf("%s\n",(char *)temp->content); free(temp->content); free(temp); temp = pop(&head); printf("%s\n",(char *)temp->content); free(temp->content); free(temp); stack_dispose(&head); return 0; }
|