1
2
3
4
5
6
7
8
9
10
11
12
13
14
#include <iostream>
int main() {
int x = 10; // 'x' is an lvalue
int* ptr = &x; // You can take the address of 'x'
std::cout << "x: " << x << std::endl;
std::cout << "Address of x: " << ptr << std::endl;
*ptr = 20; // You can modify the value of 'x' through 'ptr'
std::cout << "Modified x: " << x << std::endl;
return 0;
}
Back to lvalue