M
mdh
FAQ 1.7 shows that, amongst other things,
int i = 0;
is a definition.
Page 128 of K&R say:
"A struct declaration defines a type. The right brace that terminates
the list of members may be followed by a list of variables, just as
for any basic type. That is,
struct {.....} x, y, z:
is syntactically analogous to
int x, y, z;
in the sense that each statement declares x, y, and z to be variables
of the named type **and causes space to be set aside for them**. {My
emphasis}
My understanding was that a definition causes space to be set aside,
( eg int i = 0) but not a declaration ( eg int i) and the x, y, and z
in the above example. How can these two ideas be reconciled?
Thanks as usual.
int i = 0;
is a definition.
Page 128 of K&R say:
"A struct declaration defines a type. The right brace that terminates
the list of members may be followed by a list of variables, just as
for any basic type. That is,
struct {.....} x, y, z:
is syntactically analogous to
int x, y, z;
in the sense that each statement declares x, y, and z to be variables
of the named type **and causes space to be set aside for them**. {My
emphasis}
My understanding was that a definition causes space to be set aside,
( eg int i = 0) but not a declaration ( eg int i) and the x, y, and z
in the above example. How can these two ideas be reconciled?
Thanks as usual.