Chad said:
I'm hoping that Keith, Richard, or the rest of the regulars will
correct me on this one. I was under the impression that a scalar
variable and an object were two distinct beasts.
[...]
An object is simply a "region of data storage in the execution
environment, the contents of which can represent values" (C99 3.14).
A "scalar" type is either an arithmetic type (integer (signed or
unsigned), floating-point, complex, or imaginary) or a pointer type
(pointer to object, to an incomplete type, or to function).
The standard doesn't use the word "variable", at least not in this
sense, but roughly speaking a variable is an object [*].
So all scalar variables are objects, but not all objects are scalar
variables. Similarly, all pointer objects are scalar objects, and all
scalar objects are objects.
In particular, given:
struct pq_element *head1;
head1 is both an object and a variable.
[*] Is a const-qualified object a "variable", since it can't vary?
Is an anonymous object created by malloc() a "variable"? Is an
object that's part of another object, such as an array element or
a struct or union member a "variable"? You might have definitive
answers to any or all of these questions, but others might have
*different* definitive answers. The standard could have defined
the word "variable" and settled all these questions, but it didn't.
There's no problem using the word "variable" in cases where it's
unambiguous, but "object" is more precise.