Original Post
Hello, I am studying for my AP Exam tommorrow on C++ and I can''t figure out Linked Lists...
This is the class...node
struct node
{
int info;
node *next;
};
node *list;
The pointers are throwing me off because we never learned what they were...and here is some code...
node *GetNode(int sum);
//Creates a new node containing num and a NULL Pointer
//Returns a pointer to this node
void Append(node *& list, int num)
{
if (list == NULL)
list = GetNode(num);
else
{
node *temp = list;
while (temp->next != NULL)
temp = temp->next;
temp->next = GetNode(num);
}
}
What I don''t understand is list like an array even though its just (node *list
? I dont understand how you can have this...pointers are too confusing! Thanks!
<- Digital Explosions ->
"Discipline is my sword, faith is my shield
do not dive into uncertainty, and you may live to reap the rewards" - (Unreal Championship)