My view on references and pointers

For me the main difference between pointers and references is that pointers are variables and references are values.
the same way that num in int num = 5 is a variable and 5 is a value.
Pointers are a variable type that contains an address and there is a subtype for each type because each type is defined by a memory size.
A reference is a value of type memory address.
So that’s why you can do int * number = #

Privacy & Terms