what exactly is tags in C?

S

s.subbarayan

Dear all,
With respect to structures whats actually "tags" in C?Is is that
tags are mainly used for self referential structures and what else are
the purpose of using tags in C?How does a tag differ from typedef with
respect to structures in C?
Expecting all your replys and advanced thanks for the same,
Regards,
s.subbarayan
 
R

Richard Bos

With respect to structures whats actually "tags" in C?

The tag is the identifier used to refer to a struct, union or enum type.
For example, in struct rectangle { int height; int width; };, rectangle
is the tag.
Is is that tags are mainly used for self referential structures

No; they're used for any tag that you want to refer to without using
typedef.
How does a tag differ from typedef with respect to structures in C?

A typedef name is in the normal name space; if you have a typedef foo
you can't also have an int foo.

Richard
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,154
Messages
2,570,870
Members
47,400
Latest member
FloridaFvt

Latest Threads

Top