Lab3.c -...

This preview shows page 1 - 2 out of 2 pages.

#include<stdio.h>#include<windows.h>#include<string.h>struct node{char data;struct node *pNext ;};typedef struct node NODE ;struct stack{NODE *pTop ;};typedef struct stack STACK ;void KhoiTaoStack(STACK *st){st->pTop = NULL ;}NODE *KhoiTaoNode(char x){NODE *p ;p = malloc(sizeof(NODE)*1);if(p == NULL){printf("khong du bo nho de cap phat !!!");return;}else{p->data = x ;p->pNext = NULL ;return p ;}}int IsEmty(STACK *st){if(st->pTop == NULL){return 0 ;}return 1 ;}int PUSH(STACK *st , NODE *p){if(IsEmty(st) == 0){st->pTop = p ;}else{p->pNext = st->pTop ;st->pTop = p ;}return 1 ;}int TOP(STACK *st){if(IsEmty(st) == 0){

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture