-2

guys what's the meaning of -> in linked list?? explain with example please I've searched online and none of the site tells what's this thing and just go straight to coding

example

start=start->next; // (a)
start->prev = NULL; // (b)

is the meaning of

(a) moving start to next node and then assign the next node to start??

(b) idk what it means ,i need explanation thanks

Kninnug
  • 7,992
  • 1
  • 30
  • 42
user2421843
  • 47
  • 3
  • 7
  • possible duplicate of [Arrow operator (->) usage in C](http://stackoverflow.com/questions/2575048/arrow-operator-usage-in-c) –  Jul 27 '13 at 11:25
  • Did you see : http://stackoverflow.com/questions/15441745/explanation-of-code-linked-list-c/15442045#15442045 ? – P0W Jul 27 '13 at 11:27

3 Answers3

1

The -> symbol is an operator to select an element from a data structure pointed to by a pointer. So suppose you have a pointer defined as mystruct *p and it points to a mystruct instantiation. Suppose also that mystruct declares a variable i of, say, type int. Then the following notations are equivalent:

(*p).i = 2;

or

p->i = 2;
Alan
  • 929
  • 6
  • 10
0

So, no coding just plain small explanation :-

-> is structure dereference operator

After execution of above statements

a) start pointer will points to the direct next node of itself.

b) start's previous pointer will be assigned to NULL (indicating end of list)

A Doubly linked list, as in your question, is represented as:

enter image description here

Start Pointer is start i.e. start/head of node.

Null is NULL indicates end of list in both the direction.

next pointer signifies next

prev pointer signifies prev

P0W
  • 46,614
  • 9
  • 72
  • 119
-2

That means delete the start node from a double-side list.

And -> is an operator .

Lidong Guo
  • 2,817
  • 2
  • 19
  • 31