diff --git a/DeitelC/Chapter7/maze7-25.c b/DeitelC/Chapter7/maze7-25.c new file mode 100644 index 0000000..ef42a55 --- /dev/null +++ b/DeitelC/Chapter7/maze7-25.c @@ -0,0 +1,40 @@ +#include +#define SIZE 12 + +int main(void) { + char maze[SIZE][SIZE]; + + // Initialize all rows + char *maze_data[SIZE] = { + "############", + "#...#......#", + "..#.#......#", + "###.#....#.#", + "#....###.#.#", + "#####.#.#.#.", + "#..#.#.#.#.#", + "##.#.#.#.#.#", + "#........#.#", + "######.###.#", + "#......#...#", + "############" + }; + + // Copy the maze data (more efficient than individual assignments) + for(int i = 0; i < SIZE; i++) { + for(int j = 0; j < SIZE; j++) { + maze[i][j] = maze_data[i][j]; + } + } + + // Print the entire maze + printf("12x12 Maze:\n"); + for(int i = 0; i < SIZE; i++) { + for(int j = 0; j < SIZE; j++) { + printf("%c", maze[i][j]); + } + printf("\n"); + } + + return 0; +}