prog.cpp:43:5: error: 'stack' does not name a type
stack<int> list;
^
prog.cpp: In member function 'ListNode* Solution::reverseList(ListNode*)':
prog.cpp:20:11: error: 'list' was not declared in this scope
list.push(p->val);
^
prog.cpp:23:39: error: taking address of temporary [-fpermissive]
ListNode *result =&(ListNode(0));
^
prog.cpp:26:14: error: 'list' was not declared in this scope
while(list.empty()!)
^
prog.cpp:26:26: error: expected ')' before '!' token
while(list.empty()!)
^
prog.cpp:26:27: error: expected primary-expression before ')' token
while(list.empty()!)
^