Sunday 15 July 2012

c - Assignment from incompatible pointer type when using Linked Lists -


I am trying to use a simple linked list example, the origin behind the use of them for later use In an effort to understand the idea However, I have been confused about how to determine each node in the list. I am here, I want to set "A" member of member "B" at "B" member and C address. However, this is where the warning occurs,

  #include  Data = 0; A-> gt; Next = null; Structure list * b = malloc (size (structure list)); B-> Data = 1; B-> Next = null; Structure List * c = malloc (sizeof (Structure List)); C-> Data = 2; C- & gt; Next = null; A-> gt; Next = & amp; Nbsp; // The alert goes here- b-> Next = & amp; C; }  

Is there any way to set the value of next (a.next) and b-> next (b.next) without any warning?

a-> next type is struct list * < / Code>.

b is of type struct list * .

& amp; B type structure list ** .

You probably wanted to: a-> next = b;


No comments:

Post a Comment