online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code   
Language
/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode() : val(0), next(nullptr) {} * ListNode(int x) : val(x), next(nullptr) {} * ListNode(int x, ListNode *next) : val(x), next(next) {} * }; */ class Solution { public: ListNode* deleteDuplicates(ListNode* head) { if(head==NULL or head->next==NULL){ return head; } ListNode* c = new ListNode(head->val); ListNode* d = c; int data = head->val; while(head!=NULL){ if(head->val==data){ head = head->next; } else{ c->next = new ListNode(head->val); c = c->next; data = head->val; head = head->next; } } //c->next = NULL; return d; } };

Compiling Program...

Command line arguments:
Standard Input: Interactive Console Text
×

                

                

Program is not being debugged. Click "Debug" button to start program in debug mode.

#FunctionFile:Line
VariableValue
RegisterValue
ExpressionValue