This question shows research effort; it is useful and clear
0
This question does not show any research effort; it is unclear or not useful
Bookmark this question.
Show activity on this post.
为什么我无法通过函数使用预定义的指针变量初始化引用变量?
int * f(int * p) {
return p;
}
int main(){
int s=10;
int *p=&s;
int *&ref1 = p; //no error given here
int *&ref2 = f(p); //gives error cannot initialize int * & with int * why??
}