ECS 30 Lecture Notes - Lecture 6: Static Variable, Global Variable, Ampersand

26 views2 pages

Document Summary

After a pointer is being assigned an object"s address the content is accessible via dereferencing operator (*). It is accessible for both reading and writing. The ampersand gets the address of the memory, and the * dereferences. It will change the content if you combine the two. Pointers need to reference something, to be dereferenced. If there is no object, then it is impossible to do and process crashes. The keyword null stands for a 0 in binary. If you place a pointer equal to null it will always be invalid. Dereferencing null always caused a segmentation fault error. Null is a reliable way to show a value is undefined. Some important usages for pointers are: output arguments for functions, arrays, and characters. When you give input into a function you are not giving the variables, you are giving the values only. Using memory addresses can help you to switch objects by swapping their memory addresses.

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