Print variable address
Create a simple program that declares an integer variable, then prints its value and its memory address.
Hint
Use the & operator on a variable to get its memory address.
Answer
#include <iostream>
int main() {
int myNumber = 42;
std::cout << "Value of myNumber: " << myNumber << std::endl;
// You can get the memory address of a variable using the & operator
std::cout << "Memory address of myNumber: " << &myNumber << std::endl;
}