This preview shows page 1. Sign up to view the full content.
Unformatted text preview: 2-Dimensional Arrays
• • Can define one array for multiple sets of data
Like a table in a spreadsheet
Use 2 size declarators in definition:
const int ROWS = 4, COLS = 3;
int exams [ROWS] [COLS];
first declarator is number of rows, second in number of columns
o columns and rows are numbered starting with 0
larger than 2-D arrays:
gender x major x city x age
2 x 100 x 30 x 25
You can use arrays with more than 2 dimensions ...
View Full Document
- Fall '08