红联Linux门户
Linux帮助

关于 int*&r=new int的疑问

发布时间:2012-05-31 17:05:16来源:红联作者:zhenghaojie
#include
using namespace std;
int main()
{
int *&r=new int;
*r=3;
cout<<"*r:"<<*r< return 0;
}
在linux终端中用g++编译出现“invalid initialization of non-const reference of type ‘int*&’ from a temporary of type ‘int*’“错误是怎么回事啊?新手,求大侠解释。
谢谢啊!
文章评论

共有 1 条评论

  1. wonderful5115 于 2012-06-02 11:19:25发表:

    这个不懂呀,路过了