/* What's wrong with this program? */ using namespace std; //required by new C++ standard #include class list { public: int head; list *tail; list(int h, list *t) {head=h; tail=t;} }; // This function is supposed to return the last integer in a linked list int last(list *L) { list *i = L; while (i != NULL && i->tail != NULL) i=i->tail; return i; } int main() { list *A = new list(2,new list(3,new list(5,NULL))); cout << last(A)*2 << endl; return 0; }