void fn ( int * copy) { copy = new int; *copy = 10; } int main() { int *x; fn(x); cout << *x; // Whats the output? }
实际他的原理是这样的 int* x创建了一个pointer,然后把x pass到fn这个function