fork download
  1. /**
  2.  * Definition for singly-linked list.
  3.  * struct ListNode {
  4.  * int val;
  5.  * ListNode *next;
  6.  * ListNode(int x) : val(x), next(NULL) {}
  7.  * };
  8.  */
  9. class Solution {
  10. public:
  11. void deleteNode(ListNode* node) {
  12. ListNode* NodeTemp = node->next;
  13. node->val = node->next->val;
  14. node->next = node->next->next;
  15. delete NodeTemp;
  16. }
  17. };
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:11:21: error: 'ListNode' has not been declared
     void deleteNode(ListNode* node) {
                     ^
prog.cpp: In member function 'void Solution::deleteNode(int*)':
prog.cpp:12:9: error: 'ListNode' was not declared in this scope
         ListNode* NodeTemp = node->next; 
         ^
prog.cpp:12:19: error: 'NodeTemp' was not declared in this scope
         ListNode* NodeTemp = node->next; 
                   ^
prog.cpp:12:36: error: request for member 'next' in '* node', which is of non-class type 'int'
         ListNode* NodeTemp = node->next; 
                                    ^
prog.cpp:13:15: error: request for member 'val' in '* node', which is of non-class type 'int'
         node->val = node->next->val;
               ^
prog.cpp:13:27: error: request for member 'next' in '* node', which is of non-class type 'int'
         node->val = node->next->val;
                           ^
prog.cpp:14:15: error: request for member 'next' in '* node', which is of non-class type 'int'
         node->next = node->next->next;
               ^
prog.cpp:14:28: error: request for member 'next' in '* node', which is of non-class type 'int'
         node->next = node->next->next;
                            ^
prog.cpp:15:16: error: type '<type error>' argument given to 'delete', expected pointer
         delete NodeTemp;
                ^
stdout
Standard output is empty