Junior — Middle
Is it possible to reassign a new memory address value to a pointer?
sobes.tech AI
Answer from AI
Yes, a pointer in C/C++ can be reassigned to a new memory address. A pointer is a variable that stores the address of another variable or memory area. Example:
int a = 5;
int b = 10;
int* ptr = &a; // ptr points to a
ptr = &b; // now ptr points to b
Thus, you can change the address that the pointer points to by assigning it a new address.