让我举一个例子就明白了我的问题:指针在主函数中的修改而不指针
void fct1()
{
int T[20];
int* p=T;//the goal is to modify this pointer (p)
fct2(&p);
}
void fct2(int** p)
{
(*p)++;//this will increment the value of the original p in the fct1
}
我要的是避免指针和只引用做到这一点,这是可能的?
您*尝试*使用参考?什么地方出了错? (另外,请不要在[C]中标记有关引用的问题。在C中没有引用) –
我正在使用visual C++,并且想使用引用,但我不知道如何? –