Since the pointer is passed to the void init (int *x) function by value, it points to another memory location where number 50 is written after its change in the line x = new int. As a result, the memory allocated by the init function leaks and 100 is displayed on the screen.
Войдите чтобы поставить Нравится
Войдите чтобы прокомментировать