MIS 24053 Lecture Notes - Lecture 26: Ex-Gay Movement, John Mauchly, Eniac

15 views8 pages

Document Summary

// 2-d array of 30 uninitialized ints int table[3][10]; // 2-d array of 18 uninitialized chars char table[3][6]; table[1][2] = "a"; char resp = table[1][2]; Declaration only reserves memory for the elements in the array. If we don"t initialize the array, the contents are unpredictable. One way to initialize a 2d array is shown below. // 2-d array of 18 initialized chars const int num_rows = 3, num_cols = 6; char table[num_rows][num_cols]={"a","b","c","d", It is highly recommended, however, that you nest the data in braces to show the exact nature of the array. For example, array table is better initialized as : // 2-d array of 18 initialized chars const int num_rows = 3, num_cols = 6; char table[num_rows][num_cols]={ Another way to fill up the values is to read them from the keyboard. For a two-dimensional array this usually requires nested for loops.

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