CS 161 Lecture Notes - Lecture 14: Memory Address, Farkle

42 views3 pages

Document Summary

Cs 161 lecture 14 1d arrays. Arrays: an order arrangement of related items, colloquially called lists, caution: lists are an actual data structure that behave differenctly from arrays, examples, array of numbers such as in a gradebook, strings -> array of characters. Int grades[5]: access each element: grades [2, array name represents: grades (first memory address location) Initial values: are garbage ( just like any other variables) Initializing and populating static 1d arrays: declaration. Individual elements: grades[0] = 0; grades[1] = 0; , using loops. Int grades[5]; // know how many times we need to step through: for(int i = 0; i < 5; i++, grades[i] = 0, or. Int i = 0: while (i < 5), grades[i] = 0; Int grades[amount]: for(int i =0; i < amount; i++), cout << please input a grade: , cin >> grades[i]; for (int i=0; i

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