At all,
const TYPE var = ini;
declares a const var variable of type TYPE . So
const PTR p=#
declares a const p variable of type PTR initialized to num .
A typedef not a text alias, so you cannot just replace the name typedef ed with its extension to see what it returns.
If you want to get
const int* const p=#
with typedef , you must typedef something to include const int , for example.
typedef const int *CI_ptr;
and then you can write
const CI_ptr p = #
(but not so, it's ugly).
And for
const int *p = #
You can write
CI_ptr p = #
And finally, in this question one of the members notices that using typedef ed pointers is bad practice. But I saw that it is widely used in many books and websites and seems convenient for this, which makes the code more understandable.
Whether this is more comprehensible or less code dependent. One thing that, in my experience, is always bad about typedef pointer types to names that hide the fact that you're dealing with pointers.
typedef struct list_node { int value; struct list_node next; } *node;
for example, this is, unfortunately, a common abuse. When you read the node type, you do not suspect that it is a pointer. At least print it before node_ptr . But then, why is typedef pointer in general, the typedef structure and use of node* shorter and clearer.
So what is the last word on it? Should typedef ed pointers be avoided as much as possible?
There is no final authority, so this is basically your decision. Follow the coding style in the company / project, if any, use your opinion if you yourself are coding.