Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Information Modeling And Relational Databases

Authors: Terry Halpin, Tony Morgan

2nd Edition

0123735688, 978-0123735683

More Books

Students also viewed these Databases questions

Question

Be familiar with the different perspectives of service quality.

Answered: 1 week ago

Question

Describe key customer feedback collection tools.

Answered: 1 week ago

Question

Know what customers expect from the firm when they complain.

Answered: 1 week ago