Karthik Rajan1 month agoMost voted5
sizeof on a reference gives sizeof the referred type, that's just how the standard defines it. Whether the reference itself takes memory isn't specified, compilers usually implement it as a pointer internally when it needs storage, but you can't observe that from the language.
Easiest way to think: pointer is its own object (has an address, can be null, can be reassigned), reference is just another name for an existing object.