#Ziglings 041

1 messages · Page 1 of 1 (latest)

silk folio
#

What is Ziglings 041 trying to teach me in general?
There can be: a pointer that points to a const value, said pointer is const (so it can't be changed to point to something else, can't modify value)
a pointer that points a variable value, said pointer is const (it can't be changed to point to something else, but it can modify the value it points to)
a pointer that points to a const value, said pointer is variable (so it can be changed to point to something else, but it can't modify the value it points to)
a pointer that points to a variable value, said pointer is variable (it can be changed to point to something else, and it can modify the value it points to)
Did i miss anything?

tiny sleet
#

that's pretty much it, this table may show it more succintly

pointer | pointee
--------+--------
const   | const
const   | mutable
mutable | const
mutable | mutable