A number of terms associated with data objects have different meanings but are easy to confuse. First, a type describes a “shape” for data objects. In C, a new name T may be defined for an existing type using the typedef construct typedef <type descriptor> T Type descriptor Here the type descriptor is an expression that tells us the shape of objects of the type T . A typedef declaration for T does not actually create any objects of that type. An object of type T is created by a declaration of the form T x; Here, x is an identifier, or “variable name.” Possibly, x is static (not local to any function), in which case the box for x is created when the program starts. If x is not static, then it is local to some function F.

 

When F is called, a box whose name is “the x associated with this call to F” is created. More precisely, the name of the box is x, but only uses of the identifier x during the execution of this call to F refer to this box. As mentioned in the text, there can be many boxes each of whose name involves the identifier x, since F may be recursive. There may even be other functions that also have used identifier x to name one of their variables.

 

Moreover, names are more general than identifiers, since there are many kinds of expressions that could be used to name boxes. For instance, we mentioned that *p could be the name of an object pointed to by pointer p, and other names could be complex expressions such as (*p).f[2] or p->f[2]. The last two expressions are equivalent and refer to the array element number 2 of the field f of the structure pointed to by pointer p.

𐌢