Tags: lec3

Q: If s is some time of struct, how do you get out member x?
A: s.x

Q: If s is a POINTER to some time of struct, how do you get out member x?
A: s->x
OR
(*s).x
These two are equivalent, but the first one is preferred.

Q: How can you get the address of x?
A: &x

Q: If p is a pointer to a value, how do you get to the value?
A: *p

Q: Consider this:
int *x = ????;
Is it equivalent to this (A)?
int *x;
x = ????;
Or this (B)?
int *x;
*x = ????;
A: It is equivalent to A.

Q: What are some reasons you might want to pass a struct pointer to a function (instead of just a struct)?
A: Performance: avoid copying the whole struct (if it is large)
Mutability: passing a pointer allows the function to modify the value to which it points