A little test based on limited understanding

int main() 
{
int A = 21;

std::cout << A << std::endl;

int* p_A = &A;//declares a pointer and assigns it the address of 'A'

std::cout << p_A << std::endl;//prints the address of A

std::cout << &p_A << std::endl;//prints the address of p_A

*p_A = 56;//directly changes the value stored in A

std::cout << A << std::endl;
return 0;

}

output

Your results will differ, different machines store memory based on architecture

2 Likes

Privacy & Terms