Please using c++ language to solve this Problem9 Consider the code fragment belo
ID: 3735770 • Letter: P
Question
Please using c++ language to solve this
Problem9 Consider the code fragment below. It is supposed to construct a 3x4 (3 rows 4 columns) 2d array of integers and set each value to zero. However, as given it does not. Add the proper dereferences ()or references (&) to make this code work properly: int rows, coll, col2, col3; rows new int[3]; ol1 new int [4]; co12new int [4]; co13 new int[4]; // Create 3 pointers to columns /I Create first row with 4 elements /I Create second row with 4 elements /I Create third row with 4 elements rows +e)-col1(e]; II Point to first row rows +1) co12[e]; Point to second row rows+2) col3[e]; // Point to third row for (int i e; ic3; i++) for (int j- e; jExplanation / Answer
int *rows, *col1, *col2, *col3; rows = new int[3]; col1 = new int[4]; col2 = new int[4]; col3 = new int[4]; *(rows + 0) = col1[0]; *(rows + 1) = col2[0]; *(rows + 2) = col3[0]; for(int i=0; iRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.