Код: Выделить всё
#include
using namespace std;
void changePP(int **ppint) {
int *n = new int;
*n = 9; //just a value for demonstration purposes
*ppint = n; //THE LINE IN QUESTION
delete n;
}
int main() {
int **ppint = NULL;
int *p = new int;
*p = 4; //another value for demonstrating
ppint = &p;
cout
Подробнее здесь: [url]https://stackoverflow.com/questions/28910673/modify-the-location-a-pointer-points-to-in-a-c-function[/url]
Мобильная версия