Page 145 - C-Language
P. 145
Examples:
int l = 90; /* the same as: */
int l; l = 90; /* if it the declaration of l was in block scope */
int c = 2, b[c]; /* ok, equivalent to: */
int c = 2; int b[c];
Later in your code, you are allowed to write the exact same expression from the declaration part of
the newly introduced identifier, giving you an object of the type specified at the beginning of the
declaration, assuming that you've assigned valid values to all accessed objects in the way.
Examples:
void f()
{
int b2; /* you should be able to write later in your code b2
which will directly refer to the integer object
that b2 identifies */
b2 = 2; /* assign a value to b2 */
printf("%d", b2); /*ok - should print 2*/
int *b3; /* you should be able to write later in your code *b3 */
b3 = &b2; /* assign valid pointer value to b3 */
printf("%d", *b3); /* ok - should print 2 */
int **b4; /* you should be able to write later in your code **b4 */
b4 = &b3;
printf("%d", **b4); /* ok - should print 2 */
void (*p)(); /* you should be able to write later in your code (*p)() */
p = &f; /* assign a valid pointer value */
(*p)(); /* ok - calls function f by retrieving the
pointer value inside p - p
and dereferencing it - *p
resulting in a function
which is then called - (*p)() -
it is not *p() because else first the () operator is
applied to p and then the resulting void object is
dereferenced which is not what we want here */
}
The declaration of b3 specifies that you can potentially use b3 value as a mean to access some
integer object.
Of course, in order to apply indirection (*) to b3, you should also have a proper value stored in it
(see pointers for more info). You should also first store some value into an object before trying to
https://riptutorial.com/ 121

