In case of declaration;
const int *p;
specifier const
is applied to int
i.e, the object p
points to.
while regarding the statement(JUNE 1998, EMBEDDED SYSTEMS PROGRAMMING);
Some declaration specifiers do not contribute to the type of the declarator-id.Rather, they specify other semantic information that applies directly to the declarator-id. For example, in:
static unsigned long int *x[N];
the keyword
static
does not apply to theunsigned long int
objects that the pointers inx
point to. Rather, it applies tox
itself:
---------------------------
/ \ / \
static unsigned long int * x [N];
This declares that
x
is a static object of type “array of N elements of pointer to unsigned long int.”
I do not understand why static
applied to x
?
static doesn't make sense to apply to the type. static applies to the storage location / visibility of x ( depending where its declared )