This is from K&R II, page 128.
The example they use is
struct point {int x; int y;};
In this case, the tag is the token "point" (without the quotes).
I think the idea they are trying to explain is that if you want to
define an object of this type, you can use
struct point p;
and if later you need to define another object of this type you can
use
struct point q;
Compare this with what happens if the structure type has no tag, as in
struct {int x; int y;};
In this case, to define an object of this type you would need
struct {int x; int y;} p;
and for a second object
struct {int x; int y;} q;
If the structure type has many members, this can be quite tiresome. It
also becomes difficult to verify that both p and q are the same type.
So the tag "point" serves as a shorter way to specify
"{int x; int y;}". This shorthand is available only for types that
have tags (unions, structures, and enums).
--
Remove del for email
This is from K&R II, page 128.
The example they use is
struct point {int x; int y;};
In this case, the tag is the token "point" (without the quotes).
I think the idea they are trying to explain is that if you want to
define an object of this type, you can use
struct point p;
and if later you need to define another object of this type you can
use
struct point q;
Compare this with what happens if the structure type has no tag, as in
struct {int x; int y;};
In this case, to define an object of this type you would need
struct {int x; int y;} p;
and for a second object
struct {int x; int y;} q;
If the structure type has many members, this can be quite tiresome. It
also becomes difficult to verify that both p and q are the same type.
So the tag "point" serves as a shorter way to specify
"{int x; int y;}". This shorthand is available only for types that
have tags (unions, structures, and enums).
--
Remove del for email
This is from K&R II, page 128.
The example they use is
struct point {int x; int y;};
In this case, the tag is the token "point" (without the quotes).
I think the idea they are trying to explain is that if you want to
define an object of this type, you can use
struct point p;
and if later you need to define another object of this type you can
use
struct point q;
Compare this with what happens if the structure type has no tag, as in
struct {int x; int y;};
In this case, to define an object of this type you would need
struct {int x; int y;} p;
and for a second object
struct {int x; int y;} q;
If the structure type has many members, this can be quite tiresome. It
also becomes difficult to verify that both p and q are the same type.
So the tag "point" serves as a shorter way to specify
"{int x; int y;}". This shorthand is available only for types that
have tags (unions, structures, and enums).