如果要改变实参的值,就传入实参的地址,当我们需要改变指针所指向的地址时,我们就需要指针的指针; 下边我们看一个实例: # include <iostream> # include <string.h> using namespace std ; void address ( char * * p ) { * p = ( char * ) malloc ( 100 ) ; } int main ( ) { char * pointer = NULL ; address ( & pointer ) ; strcpy ( pointer , "Hello,world." ) ; cout << pointer << endl ; return 0 ; } 首先定义一个空指针用于存放字符串,然后使用malloc函数开辟一个长度为100字节的内存空间,使该指针指向它 * p在本质上还是一个指针,malloc函数返回的就是一个指针变量!这里为什么不直接用一个指针是因为要改变实参pointer,要改变实参必须传入实参的地址. 来源: CSDN 作者: M’s Friday 链接: https://blog.csdn.net/Cloud_1234_5678/article/details/103605504