c - Creating a linked list with different structure types -


I am defining a linked list where the structure (the first one) has a different type of others, this first node always is present.

  type1 - & gt; Type2_1 - & gt; Type 2_2 - & gt; Type2_3-> Etc   

I should be able to rearrange the type 2 elements. For example, I might have:

  type 1 - & gt; Type2_3 - & gt; Type2_1 - & gt; Type 2_2 - & gt; Etc.   

The way I am trying to do this defines a double-linked list. Each Type2 element can be type1 next type, last and, if needed, Type1. If Type2 element is next to Type1, its indicator is set to tap on the previous Type2.

  typedef struct type 2 {struct type2 * next; Struct type 2 * previous; Int isNextToType1; } Type 2;   

Is there a better way to do this?

  typed type of type 2 {... straight typed 2 * previous; // This is the first element to tap for type 2 * next; // This is the tap for the last element} Type2; Typedef structure Type1 {... struct type2 * list; // if the list is empty it can be taped} Type1;   

It looks like you do not need anything besides this.

Comments

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -