QUESTION 7
Which of the following declarations correctly declares a two dimensional array of floats named prices that has 10
rows and 5 columns?
1. const int NUMROWS = 10;
const int NUMCOLS = 5;
float prices[NUMROWS + NUMCOLS];
2. const int NUMROWS = 10;
const int NUMCOLS = 5;
float prices[NUMROWS,NUMCOLS];
3. const int NUMROWS = 10;
const int NUMCOLS = 5;
float prices[NUMCOLS][NUMROWS];
4. const int NUMROWS = 10;
const int NUMCOLS = 5;
float prices[NUMROWS][NUMCOLS];
CORRECT ANSWER:
Option 4:
const int NUMROWS = 10;
const int NUMCOLS = 5;
float prices[NUMROWS][NUMCOLS];
Comments
Leave a comment