CISC 1600 Lecture Notes - Lecture 22: Array Data Structure

46 views3 pages

Document Summary

Array (elements of same data type) arranged in rows and columns. 3. sizes of each dimension [row][column] ex) int array[3][5]; will creates a 2d array of 3 row x 5 column; the index will be one less than the number of row/column because index starts at 0. Elements of each row are enclosed within curly braces and separated by commas. int a[4][3] = {{2, 4, 4}, Access the elements of a two-dimensional array: name of array. //print an array element from row index 1 column index 2. // assign value 13 to the array element cin>>a[1][2]; Using loop to input an two-dimensional array from user for (row = 0; row < 3; row++) for (col = 0; col < 5; col++) cin >> array[row][col]; // the size of the column must be specified. //each time 1 row finish, starts a new line. //array arr is passing its data to array a.

Get access

Grade+
$40 USD/m
Billed monthly
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
10 Verified Answers
Class+
$30 USD/m
Billed monthly
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
7 Verified Answers

Related Documents