View Single Post
Old 03-25-2009, 02:13 PM   #1 (permalink)
Seraph
 
True Techie

Join Date: Jun 2004

Posts: 125

Seraph is on a distinguished road

Default Array of Nodes? C++

I am working on a C++ project right now, and I was wondering if it is possible to make an array of Nodes.

I have created a Node class, which contains data variables:

string Element
Node* next


then it has accessors and mutators and such.

Then I am trying to create an array in another class, where each position in the array contains a pointer to a Node.

I tried doing it like this:

Node* Array[10];

and then in the constructor
for(int x=0; x<10; x++){
Array[x]=new Node();
}


That doesn't work. It gives me a fatal error.
I feel so rusty on using pointers
Seraph is offline