CSC209H5 Chapter 2: C Programming - Arrays

17 views2 pages

Document Summary

Csc209h5s - software programming and tools (winter 2018) // prints the daytime high at index 3; prints out 16. 0. Example: set the first three elements of this array to the values 4, 44 and 18, respectively. int ages[ 8 ]; ages[ 0 ] = 4 ; ages[ 1 ] = 44 ; ages[ 2 ] = 18 ; Initializing an array with values inside int a[ 3 ] = { 13 , 55 , 20 }; A[1] = address of a + 4 address of a[1] = address of a + 1 * sizeof(int) A[2] = address of a + 2 * sizeof(int) address of a[i] = address of a + (i * size of one element of a) Out of bounds is assigned a value of 0. You do not want to assign values that is out of bounds as it may cause possible errors.

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