c - What is the identifier of typedef struct -


I came to learn the linked list. But, I am quite confused in many ways to declare linked lists with struct.

This is a method, typingff structure noodt {int dataNum; Struct notepad * nextNode; } NODE;

And this is another way type is not typed

  struct NODE {int dataNum; Struct NODE * nextNode; };   

I'm curious, when we are announcing with typedef , I know that notettext to know the compiler Used for the straight notetag * next node; . But then, what is the real identifier of struct ? Notetag or NODE ? If this is notettext , then when is NODE ?

You can alternatively assign a tag to a structure, such as struct nodetag < / Code> or struct NODE . These tags (and union tags, and em tags) are in namespace separate from the common identifier.

creates a nickname for typed f version struct nodetag :

  typed node tag { ...} NODE;   

Now the common identifier is a type of name in the namespace, which is synonym or surname for struct nodetag . >

Note that you can also write:

  typedef struct noettag NODE; Structure Knowtag {Int dataNum; Node * Agnolode; };   

The first row says that 'Tag' notetag and NODE are the nickname for this type with a composition type exists' second The block says that struct nodetag belongs to these items, lists a NODE * as one of the members.


C and C ++ are two different languages ​​

Note that this question has been tagged, and you are receiving direct answer ( Which is good). However, if you have to face C ++, then you feel that:

  struct nodetag {int dataNum; Notatag * Agalanod; };   

is valid C ++ and the common identifier namespace (plus the structure in the tag notetag ) tag namespace. It is not valid in C. If you end up using the C ++ compiler to compile the C code, you may get confused.

Comments

Popular posts from this blog

excel vba - How to delete Solver(SOLVER.XLAM) code -

github - Teamcity & Git - PR merge builds - anyway to get HEAD commit hash? -

ios - Replace text in UITextView run slowly -