The *next command(?) in C

Nov 15, 2008 at 2:26am
Hi,

I've been looking through the source for the calcurse program, and I keep coming across code that looks like this:

i->next

...which comes from a structure that looks a bit like this:

struct example_s
{
struct example_s *next;
...
}

I've been trying to find out what this does exactly. Looking at various C pages, it has something to do with a tree node? Is the C++ equivalent the for_each for a vector (assuming you put the structure/class into that vector)? I've tried to make a small program that shows me what this does, but, to no avail. Would someone please provide a small example of what the *next operator does? Thank you.
Nov 15, 2008 at 2:53am
Google "linked list".
Nov 15, 2008 at 3:08am
Thanks Duoas.

I ended up doing the example at:

http://www-h.eng.cam.ac.uk/help/tpl/languages/C/teaching_C/node44.html

...and I figured it out.
Nov 15, 2008 at 3:31am
Brilliant!

Five gold stars for you. You ought to hang out here and help others too. (Seriously)
Nov 15, 2008 at 7:08am
Sure thing.

I'm learning all sorts of stuff reading source code. I'll do what I can.
Topic archived. No new replies allowed.