Dereferencing
To operate with the variable, you can also access it by dereferencing the variable's pointer. For example, you can change the value of the variable by using pointers:
123456int b = 1; int *pb = &b; *pb = *pb + 2; // b = 1 + 2 b = 3 + *pb; // b = 3 + 3 cout << b << endl;
In all the statements above, we added numbers to the value of b
and assigned the result to the variable b
.
Все було зрозуміло?
Дякуємо за ваш відгук!
Секція 2. Розділ 3
Запитати АІ
Запитати АІ
Запитайте про що завгодно або спробуйте одне із запропонованих запитань, щоб почати наш чат
Awesome!
Completion rate improved to 2.94
Dereferencing
Свайпніть щоб показати меню
To operate with the variable, you can also access it by dereferencing the variable's pointer. For example, you can change the value of the variable by using pointers:
123456int b = 1; int *pb = &b; *pb = *pb + 2; // b = 1 + 2 b = 3 + *pb; // b = 3 + 3 cout << b << endl;
In all the statements above, we added numbers to the value of b
and assigned the result to the variable b
.
Все було зрозуміло?
Дякуємо за ваш відгук!
Секція 2. Розділ 3