Recommended Answers
Jump to Post1. References are similar to pointers. But not same. That's why the std committee came up with 2 different things. :).
2. "references same as a constant pointer to a variable" => Yes, a reference and a const ptr to a var would work "almost" same way (you'll use different …
Jump to PostNo, What i wanted to ask was about their storage in the memory
But is it always...or is it compiler dependent...??From std: sizeof operator: "When applied to a reference or a reference type, the result is the size of the referenced type. When applied to a class, the result …
Jump to Postexcept in a trivial situation, where the compiler can optimize away the storage, a reference is stored in memory as an address. so for,
struct A { double& ref ; A(double&d) : ref(d) {} };
sizeof(A) == sizeof(double*)
when a reference is passed to a function, what is passed …
All 11 Replies
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.