what are the errors in these codes? void showValues(int nums) { for (int count =
ID: 3611085 • Letter: W
Question
what are the errors in these codes? void showValues(int nums) { for (int count = 0; count < 8;count++) cout << nums[count]; } void showValues(int numbs[4][ ]) { for (rows = 0; rows < 4; rows++) for (cols = 0; cols , 5;cols++) cout<< nums[rows][cols]; } what are the errors in these codes? void showValues(int nums) { for (int count = 0; count < 8;count++) cout << nums[count]; } void showValues(int numbs[4][ ]) { for (rows = 0; rows < 4; rows++) for (cols = 0; cols , 5;cols++) cout<< nums[rows][cols]; }Explanation / Answer
void showValues( int nums[]) // here I bolded to show you this ishow you pass your array nums{ for (int count = 0; count < 8;count++) cout << nums[count]; } void showValues(int numbs[][]) // this is how you pass the 2 dimensional array address tothe function
{ for (rows = 0; rows < 4; rows++) for (cols = 0; cols< 5; cols++) // you previously had cols ,5 I think this was a typo
cout<< nums[rows][cols]; }
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.