Unhandled exception at 0x00e51c51 in project.exe: 0xC0000005: Access violation writing location 0x00000000.

I am receiving error Unhandled exception at 0x00e51c51 in project.exe: 0xC0000005: Access violation writing location 0x00000000 when I run the following code:

#pragma once
#include <iostream>
using namespace std;

template <class T, class index=int>
class Node
{
public:
T data;
Node<T,index>* next;
Node<T,index>* prev;
Node(T info, Node<T,index> *p= NULL, Node<T,index> *n=NULL) {data = info; prev = p; next = n;};
Node<T,index> & operator = (T &);
Node<T,index> & operator = (Node<T,index> &);
};

template <class T, class index>
inline Node<T,index> & Node<T,index>::operator=(T & type)
{
data =type;
return *this;
}


The exception points to the bold piece.
Last edited on
It's likely that the surrounding node is null.
What do you mean? How do I fix it?
What do you mean?

You have a pointer that is a null pointer. This means it doesn't point to any memory. It has a value of zero. The big clue is this great big zero: 0x00000000

How do I fix it?

Work out which pointer is a null pointer, and don't dereference it.


Topic archived. No new replies allowed.