What is a pointer?
It is a variable that stores a memory address, the address of a another variable.
What is a reference?
It is an alias for an exisiting variable.
Explain pass-by-value and pass-by-reference
Pass-by-value means that a copy of the value is passed to the function, any modification stays within the function.
Pass-by-reference means that an alias is given to the function, any modification also affects the original variable.
What does an uninitialized pointer point to?
An uninitialized pointer points towards a “garbage” value, meaning towards an arbitrary memory location.
Can you reseat a reference?
No, once bound a reference cannot be changed to refer to another variable.
What does the the operator & do?
itr is the address-of operator, it returns the memory address of a variable.
What are pass by-reference and pass-by-pointer?
Pass by poinyret mean sending the memory location to the function while pass-by-reference means sending a reference variable of a varible. Since they are the same it allows us to modify the variable.
What are the differences between a pointer and a smart pointer?
A raw pointer does not express ownership, simply tells you the address and must be deleted manually.
A smart pointer deletes the memory once it goes out of bound, implies some forme of ownership and.