Try to get into the habit of initializing your variables when you declare them.
Code:
#include <stdio.h>
int main()
{
int const ci = 123;
const int *const cpi = &ci;
printf("%d\n",*cpi);
return 0;
}
Note, these two style of declarations are the same:
Code:
int const ci = 123;
/* and */
const int ci = 123;
Personally, I prefer the second style; it is more intuitive for me to comprehend. And because you opted to declare ci as a const int, it was necessary to declare cpi such that the value it points to also would be treated as const.
Alternative declarations for cpi could be:
Code:
int const *const cpi = &ci;
/* or even */
const int const* cpi = &ci;
Again, I prefer the last style, although I rarely ever declare the pointer itself as const. All I typically care about is that the value that is being referenced is const.