//maze.h
#define MAZE_WALL "■"
#define MAZE_SPACE "□"
#define MAX_row 10
#define MAX_col 10
char maze[MAX_row][MAX_col] = {
1,1,1,1,1,1,1,1,1,1,
0,0,1,1,1,1,1,1,1,1,
1,0,1,1,0,0,0,1,0,1,
1,0,0,0,0,1,0,1,0,1,
1,0,1,1,1,1,0,1,0,1,
1,0,1,0,0,0,0,1,0,1,
1,0,1,0,1,1,1,1,0,1,
1,1,1,0,0,0,0,0,0,1,
1,0,0,0,1,1,1,1,0,1,
1,1,1,1,1,1,1,1,0,1
};
void printMaze();
void printMaze(){
int i,j;
for(i=0;i<MAX_row;i++){
for(j=0;j<MAX_col;j++){
if(maze[i][j]==1)
printf(MAZE_WALL);
else
printf(MAZE_SPACE);
}
printf("n");
}
}
//stack.h
#define MAX_STACK_SIZE 100
typedef struct{
int row;
int col;
}element;
element stack[MAX_STACK_SIZE];
int top = -1;
void push(element item)
{
if(top >= MAX_STACK_SIZE - 1) {
printf("stack_full()n");
return;
}
stack[++top] = item;
}
element pop() {
if(top == -1)
{
printf("stack_empty()n"); exit();
}
return stack[(top)--];
}
int isempty()
{ if( top == -1 ) return(1); else return(0); }
int isfull()
{ if ( top >= MAX_STACK_SIZE -1 ) return(1); else return(0); }
//main.c
//미로찾기
#include <stdio.h>
#include "stack.h"
#include "maze.h"
int main()
{
element x,y;
x.col=7;
x.row=1;
push(x);
y=pop();
printf("%d %dn",y.row,y.col);
printMaze();
}


