Problem with a constructor that gets a pointer as a parameter

Hi,

I have a constructor that gets a pointer as a parameter, and
I want the constructor to copy one of the pointer's members.
Here is an example of the code:
1
2
3
Node(Node<T>* nd){
data = nd->data;
}


After I compile and run the exe, I get this error:
Unhandled exception at 0x004122f9 in Project2.exe: 0xC0000005: Access violation reading location 0xcccccccc.


What can I do?

Thanks.
Perhaps you're accessing heap memory that's been deallocated. Show us some code that uses this constructor.
Yeah, 0xcccccccc is standard microsoft for "uninitialized".
Topic archived. No new replies allowed.