COMPSCI 61C Lecture Notes - Lecture 4: Dereference Operator

47 views3 pages

Document Summary

Consider memory to be a single huge array. Each cell of the array has an address associated with it. For addresses, we use unsigned numbers (negative addresses don"t make sense) [note] do not confuse the address referring to a memory location with the value stored there. An address refers to a particular memory location. Pointer: a variable that contains the address of the variable. How to get a value pointed to: * Java and c pass parameters by value (they copy the parameter, so the copy cannot change the original) How can we get a function to change the value held in a variable? void add_one (cid:383)int *p(cid:384) { Pointers can point to any kind of data (int, char, struct, etc. ) Normally, pointers can point to only one type void* is a type that can point to anything (generic pointer) [note] try not to use void to avoid program bugs, security issues, etc.

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