0
Why the output is 26 not 23? Why did the value of (*p2) also change to 13?
#include <iostream> using namespace std; int main() { int a=10; int b=13; int *p1=&a; int *p2=&a; *p1=b; cout<<(*p1)+(*p2); return 0; }
1 Answer
+ 1
its like having two same copies of a box. If you change the contents, it will in the copy (technically its not a copy but hey, this is an analogy).