Question: Please make sure the Letters are not randomly generated it should start from A and end at Z and also make sure that all the


Please make sure the Letters are not randomly generated it should start from A and end at Z and also make sure that all the checks mentioned are taken care of please make sure it is the same as the output.
Write a program called random__ wa. k. c that generates a "random walk" across any 2-D array, starting at the top left corner. The program must randomly "walk" from element to element, always going up, down, left, or right by one element. The elements visited by the program will be labelled with the letters A through z (i.e., do not walk past z ), in the order visited. Hint. Use srand and rand functions to generate random numbers. Remember that you want to generate a number between 03, which can correspond to each possible direction of the next move. Before performing a move, check (1) that it won't go outside the array, and (2) that it doesn't visit an element that already has a letter assigned. If there is no position it can visit without violating these conditions, the program must terminate and indicate the last letter it was able to write. Here are three samples of what a program run might look like (print a dot for unvisited elements): Enter number of rows: 3 Enter number of columns: 2 Walked until letter D A D B C Your program must contain the following functions (note that here, you are making use of c99's variable length array parameters feature): void generate_random_walk (int n, int m, char walk [n][m] ) ; void print_array (int n, int m, char walk [n][m] ); After reading all necessary input from the user and declaring the array, the main function of your program must call generate_random_walk. generate_random_walk must first initialize the array to contain '.' characters. It then replaces the '.' characters with the letters from A to Z as it does its random walk through the array. main then calls print _ array to display the array on the screen. Note: you need to think about the right place to print the statement which indicates that the last letter has been reached. You cannot change the function prototypes indicated above
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
