Z
zhou xiang
1.when I write the following codes:
....
int ival = 1024;
int *p = &ival;
int *&rval = p;
....
there is no errors.
2.When I write the following codes:
....
int ival = 1024;
//int *p = &ival;
int *&rval = &ival;
....
the complier shows errors :"cannot convert from 'int *' to 'int *& '
A reference that is not to 'const' cannot be bound to a non-lvalue"
3.When I write the following codes:
....
const int icval = 1024;
const int *const &ricval = &icval;
....
There is no errors.
What is the difference in these codes?
....
int ival = 1024;
int *p = &ival;
int *&rval = p;
....
there is no errors.
2.When I write the following codes:
....
int ival = 1024;
//int *p = &ival;
int *&rval = &ival;
....
the complier shows errors :"cannot convert from 'int *' to 'int *& '
A reference that is not to 'const' cannot be bound to a non-lvalue"
3.When I write the following codes:
....
const int icval = 1024;
const int *const &ricval = &icval;
....
There is no errors.
What is the difference in these codes?