southwest的点数expire嘛?# Money - 海外理财
i*t
1 楼
reference to pointer问题
void f(const int * & p)
{
int i =0;
i = p[0];
cout<< i< system("PAUSE");
}
int main()
{
int * p =new int[1];
p[0] =102;
f(p);
return 1;
}
这样编译不过去
error C2664: 'f' : cannot convert parameter 1 from 'int *' to 'const int *&'
如果吧函数改一下就可以了void f( int * & p) 或者void f( int * p)
都没问题
奇怪为啥最开始那个不行呢?
void f(const int * & p)
{
int i =0;
i = p[0];
cout<< i<
}
int main()
{
int * p =new int[1];
p[0] =102;
f(p);
return 1;
}
这样编译不过去
error C2664: 'f' : cannot convert parameter 1 from 'int *' to 'const int *&'
如果吧函数改一下就可以了void f( int * & p) 或者void f( int * p)
都没问题
奇怪为啥最开始那个不行呢?