Jin Jin - 1 year ago 60
C Question

What does 'designate an object' mean in C?

For example,

int x = 10;

we say that "
designates an int object which stores 10". But what does "designate" exactly mean? Does it mean
behaves like a label which refers to the whole chunk of memory?

Answer Source
  1. x is an identifier.
  2. There is an int object (i.e. a region of storage) containing the value 10.
  3. The identifier x is associated with that int object.

The C standard uses the English word designate to express the relationship between an identifier and the object it identifies. You could say the same thing in several different ways. I said "associate" just now, there are many words we could choose. "x is a label for this region of memory" would be another way.

Note: designating is not limited to identifiers. Other expressions can designate an object too. For example *(&x) also designates the same object, as does *(&x + 0).

When an expression designates an object, the expression may be used to either assign a value to the object, or retrieve the value from the object. (The same syntax covers both of those cases; it depends on context whether the value is read or written).

The word lvalue means an expression that might designate an object (according to the above definition of 'designate').