Solve the maze function using stack.PLEASE ONLY C CODE, DONT USE C++ AND C# . /* R\C 0 1 2 3 4 5 6 7 */ /* 0 */ {0, 0, 0, 1, 0, 0, 0, 0}, /* 1 */ {0, 1, 1, 1, 0, 0, 1, 0}, /* 2 */ {0, 1, 0, 1, 0, 0, 1, 0}, /* 3 */ {0, 1, 0, 1, 1, 1, 1, 0}, /* 4 */ {0, 1, 0, 0, 0, 0, 1, 1}, /* 5 */ {0, 1, 1, 0, 1, 1, 1, 0}, /* 6 */ {0, 0, 0, 0, 1, 0, 0, 0}, /* 7 */ {0, 0, 0, 0, 1, 0, 0, 0}, void solve_maze() { int M[8][8] = { /* R\C 0 1 2 3 4 5 6 7 */ /* 0 */ {0, 0, 0, 1, 0, 0, 0, 0}, /* 1 */ {0, 1, 1, 1, 0, 0, 1, 0}, /* 2 */ {0, 1, 0, 1, 0, 0, 1, 0}, /* 3 */ {0, 1, 0, 1, 1, 1, 1, 0}, /* 4 */ {0, 1, 0, 0, 0, 0, 1, 1}, /* 5 */ {0, 1, 1, 0, 1, 1, 1, 0}, /* 6 */ {0, 0, 0, 0, 1, 0, 0, 0}, /* 7 */ {0, 0, 0, 0, 1, 0, 0, 0}, }; int I, J, R = 0, C = 3; LINKED_STACK stack; POS pos = (POS)malloc(sizeof(POS)); int flag; stack = stack_init(); do { // TODO: Fill this block. } while (R != 7 && C != 7 && R != 0 && C != 0); } int main() { solve_maze(); return 0; }
Solve the maze function using stack.PLEASE ONLY C CODE, DONT USE C++ AND C# .
/* R\C 0 1 2 3 4 5 6 7 */
/* 0 */ {0, 0, 0, 1, 0, 0, 0, 0},
/* 1 */ {0, 1, 1, 1, 0, 0, 1, 0},
/* 2 */ {0, 1, 0, 1, 0, 0, 1, 0},
/* 3 */ {0, 1, 0, 1, 1, 1, 1, 0},
/* 4 */ {0, 1, 0, 0, 0, 0, 1, 1},
/* 5 */ {0, 1, 1, 0, 1, 1, 1, 0},
/* 6 */ {0, 0, 0, 0, 1, 0, 0, 0},
/* 7 */ {0, 0, 0, 0, 1, 0, 0, 0},
void solve_maze()
{
int M[8][8] = {
/* R\C 0 1 2 3 4 5 6 7 */
/* 0 */ {0, 0, 0, 1, 0, 0, 0, 0},
/* 1 */ {0, 1, 1, 1, 0, 0, 1, 0},
/* 2 */ {0, 1, 0, 1, 0, 0, 1, 0},
/* 3 */ {0, 1, 0, 1, 1, 1, 1, 0},
/* 4 */ {0, 1, 0, 0, 0, 0, 1, 1},
/* 5 */ {0, 1, 1, 0, 1, 1, 1, 0},
/* 6 */ {0, 0, 0, 0, 1, 0, 0, 0},
/* 7 */ {0, 0, 0, 0, 1, 0, 0, 0},
};
int I, J, R = 0, C = 3;
LINKED_STACK stack;
POS pos = (POS)malloc(sizeof(POS));
int flag;
stack = stack_init();
do
{
// TODO: Fill this block.
} while (R != 7 && C != 7 && R != 0 && C != 0);
}
int main()
{
solve_maze();
return 0;
}
Trending now
This is a popular solution!
Step by step
Solved in 2 steps