Explain ? Yes indeed...
A pointer points (Yes, this is his job !) to a certain piece of memory. If
you don't initialise the part of memory where it points, you might get
unpredictable values through the pointer or sometimes memory crashes.
When you declare a pointer like :
struct _s *next;
C++ knows that the next pointer points to a part of memory that contains a
"struct _s" type of data. BUT a first, the pointer points to...nothing or
random adress ! You first have to allocate some memory (malloc) to receive a
struct _s data. Then, acessing to the "next" pointer gives you access to a
struct _s for *real* this time.
But, if you think you're not a CPP hero, I think you might get some books
about it and read it from cover to cover.
There are a huge amount of tutorials for newbies almost everywhere on the
net. Just check out Google for this.
Kind regards
--
Seb
|