C Programming on the IBM PC (C Programmers Reference Guide Series)
|
|
In C, the name of a structure, union, or enumeration does not define a complete type name. In C++, it does. For example, the following fragment is valid for C++, but not for C:
struct s_type { int i; double d; }; // ... s_type x; // OK for C++, but not for C
In C++, s_type defines a complete type name and can be used, by itself, to declare objects. In C, s_type defines a tag, which is not a complete type specifier. In C, you need to precede a tag name with either struct, union, or enum when declaring objects. For example,
struct s_type x; // now OK for C
The preceding syntax is also permissible in C++, but seldom used.
|
|