elsewhere (e.g., in another file)
example: extern int my_array[];
Handy Heuristic
Distinguishing a Definition from a Declaration
You can tell these two apart by remembering:
A declaration is like a customs declaration:
it is not the thing itself, merely a description
of some baggage that you say you have
around somewhere.
a definition is the special kind of
declaration that fixes the storage
for an object
The declaration of an external object tells the compiler the type and name of the object, and that
memory allocation is done somewhere else. Since you aren't allocating memory for the array at this
point, you don't need to provide information on how big it is in total. You do have to provide the size
of all array dimensions except the leftmost one—this gives the compiler enough information to
generate indexing code.
How Arrays and Pointers Are Accessed
In this section we show the difference between a reference using an array and a reference using a
pointer. The first distinction we must note is between address y and contents of address y. This is
actually quite a subtle point, because in most programming languages we use the same symbol to
represent both, and the compiler figures out which is meant from the context. Take a simple
assignment, as shown in Figure 4-1.
Figure 4-1. The Difference between an Address (l-value) and the Contents of the
Address (r-value)