The following line creates pointer
param1 to
int variable, which has value 2:
int * param1 = new int(2);
reference is now pointing to the
param2 and contains it's address.
int * reference = ¶m2;
When comparing, we use dereference operator (*) to access the real values, not addresses, therefore result is true.
Since
printf function prints result as decimal integer value ("%d"), 1 is written in output.
Войдите чтобы поставить Нравится
Войдите чтобы прокомментировать