Re: [Dev-C++] my delete function in my linked list
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Jason S. <mys...@op...> - 2001-11-10 01:43:47
|
Hey everyone,
Why would you use a struct like that over just using a pointer like he has?
I've just been taught linked lists recently in school, have a test monday on them actually...but I don't see the advantage of using the struct over the pointer if you are only going to keep the start pointer. Of course like you said, if you want an end pointer or the size of the struct...
As well, I was taught *& too, p is before r in the alphabet was the little way to remember it.
Jay
----- Original Message -----
From: Jason Hardman
To: Dev-C++
Sent: Friday, November 09, 2001 8:20 PM
Subject: Re: [Dev-C++] my delete function in my linked list
I'm a bit confused by your use of *&list in the arguments. I assume you you
want a reference to the list pointer so you can modify it, but I would have
thought that the correct notation would be &*list, or maybe &(*list)? I
don't have any experience in doing that as it is probably a bad way of
programming (no offence). Usualy when creating a list you put it in a
container, i.e.
struct list
{
node *start;
};
You can then pass a pointer to the list struct and the fuctions will operate
on it's start member. In some lists you can also keep a pointer to the end,
or maintain number for the size of the list. I bet you are doing this for a
lesson, otherwise it would be easier to use the C++ STL container list.
|