Question: 5. (25 points) For this question, do not worry about error checking. Assume all inputs to functions will be valid, and no malloc errors will

 5. (25 points) For this question, do not worry about error

5. (25 points) For this question, do not worry about error checking. Assume all inputs to functions will be valid, and no malloc errors will occur. Ignore all trivial typos (e.g., missing :) in the code below and assume it will work as intended. (25 minutes) Given the following code that implements a 2-D Cartesian coordinate system: typdef struct { int x // x-axis position // y-axis position int val // value in that position } point_t int y int main(int argc, char** argv) { int rows = atoi (argv[1]) // number of rows in the 2-D array int cols = atoi(argv[2]) // number of columns in the 2-D array // create a 2D array of point_t* point_t*** my-grid init_2d_grid(&my-grid, rows, cols) // Print out the coordinate system print-grid(my-grid, rows, cols) } void print_grid(point_t*** my-grid, int rows, int cols) { for(int i = 0; i x, my-grid[i][j]->y, my-grid[i][j]->val) } printf(" ") } } 5. (25 points) For this question, do not worry about error checking. Assume all inputs to functions will be valid, and no malloc errors will occur. Ignore all trivial typos (e.g., missing :) in the code below and assume it will work as intended. (25 minutes) Given the following code that implements a 2-D Cartesian coordinate system: typdef struct { int x // x-axis position // y-axis position int val // value in that position } point_t int y int main(int argc, char** argv) { int rows = atoi (argv[1]) // number of rows in the 2-D array int cols = atoi(argv[2]) // number of columns in the 2-D array // create a 2D array of point_t* point_t*** my-grid init_2d_grid(&my-grid, rows, cols) // Print out the coordinate system print-grid(my-grid, rows, cols) } void print_grid(point_t*** my-grid, int rows, int cols) { for(int i = 0; i x, my-grid[i][j]->y, my-grid[i][j]->val) } printf(" ") } }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!