COMPTNG 10A Lecture Notes - Lecture 4: Memory Address

73 views1 pages
14 Sep 2017
School
Professor

Document Summary

A variable is stored somewhere in memory. The address-of operator (&) returns the memory address of the variable. Arrays are actually (98%) pointers! int ages[10]; int* ptr = ages; // ptr has address of ages[0: ptr[0] to ptr[9] to print all of ages, since ages is of type int*, it points to a memory address at which an integer is stored. It points to the beginning of the 0th int. If you create an int, then create another int, they may not be in memory addresses next to each other: however, within an array, each value/byte will be next to each other.

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents