0
X value is constant 5 , and z denote the address of x value . But we don't know address of x value.it show error output why ?
int*z; int const x= 5; z=&x; z++; cout<<z;
2 RĂ©ponses
+ 1
You have defined value of x constant and after that you created reference variable which is z=&x ; first read the concept of reference if you change the value of z then x will automatically change and you cannot change the value of constant variable so its error.
0
int* cannot point to const int. You need to declare const pointer e.g. int const* z.