CS136 Lecture Notes - Lecture 9: Memory Address, Indirection, Scanf Format String

47 views5 pages

Document Summary

* p = 32; // follow pointer p and change value for i (mutate that int) A = *p; // follow the pointer p and get the value from there -> 32: ( *p * *p ) //take value which p points to and times by the value p points to. // &p type is int *: int **pp = &p; // pp is a pointer to a pointer to an int, stores memory. // address of a pointer to an int pp > p > i = 42. Null pointer: always set to null when initializing or done. Thursday, february 1, 2018: never dereference a null pointer. Int i = *p // crash (segmentation false) Pointer assignment: assigns the address of j to p. Int *q = &j; // change p to pointer at what q points at: aliasing: when the same memory address can be accessed from more than one variable.

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