首页 > 代码库 > reference

reference

z@z:~$ g++ -std=c++11 ref.cpp
ref.cpp:7:10: error: invalid conversion from ‘int’ to ‘int*’ [-fpermissive]
int *a = i;
^
z@z:~$ g++ -std=c++11 ref.cpp

 

int i = 123;
//同类型才可以赋值
int *a = &i; int main() { cout << i << endl; return 0; }

 

reference