Relative Content

Tag Archive for c++literals

Memory address of integer literals via ref in C++

#include <iostream> using namespace std; int main() { // Case 1 cout << &5; // This line fails to compile. Ok, I get this because “5” is a rvalue. // Case 2 const int& ref = 5; cout << &ref; // Works fine. Why? // Case 3 cout << &”SomeString”; // Works fine. Ok, I […]