Ktoś wie dlaczego kompilator krzyczy że to zwraca 'exited with non-zero status'? I w ogóle nie reaguje na wywołanie tego operatora?
#include <iostream>
using namespace std;
class Node{
public:
Node * next;
int data;
Node(){
Node *n= new Node;
n->data = 0;
n->next = NULL;
}
~Node(){
int *ptr = &data;
delete ptr;
delete next;
}
};
class List{
public:
Node* head;
List(){
Node *p = new Node;
p = NULL;
head = p;
}
~List(){
Node *p = head;
Node *x;
while(p){
x = p->next;
delete p;
p = x;
}
}
friend istream & operator >> (istream &s, List &l){
Node *p,*t = l.head;
s >> p->data;
p->next = NULL;
if (l.head==NULL){
l.head = p;
}else{
while(t){
t = t->next;
}
t->next = p;
}
}
};
int main(void){
List L;
return 0;
}