online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code   
Language
#include <stdio.h> #include <stdlib.h> #include <conio.h> #include <malloc.h> struct node { int data; struct node * next; }; // decalre all functions struct node * start = NULL; struct node * create_ll(struct node * ); struct node * display(struct node * ); struct node *sort_list(struct node *); void main() { int option; do { printf("\n\n *****MAIN MENU *****"); printf("\n 1: Create a list"); printf("\n 2: Display the list"); printf("\n 3: Sort linked list"); printf("\n 4: EXIT"); printf("\n\n Enter your option : "); scanf("%d", &option); switch (option) { case 1: start = create_ll(start); printf("\n Linked List Created"); break; case 2: start = display(start); break; case 3: printf("\n Sorted linked list data"); start = sort_list(start); break; } } while (option != 4); getch(); } //Create linked list function //it will keep asking for data until -1 is entered struct node * create_ll(struct node * start) { struct node * new_node, * ptr; int num; printf("\n Enter -1 to end"); printf("\n Enter the data: "); scanf("%d", & num); while (num != -1) { new_node = (struct node * ) malloc(sizeof(struct node)); new_node -> data = num; if (start == NULL) { new_node -> next = NULL; start = new_node; } else { ptr = start; while (ptr -> next != NULL) ptr = ptr -> next; ptr -> next = new_node; new_node -> next = NULL; } printf("\n Enter the data : "); scanf("%d", & num); } return start; } //display linked list data //after looping it from start until NULL struct node * display(struct node * start) { struct node * ptr; ptr = start; while (ptr != NULL) { printf("\t %d", ptr -> data); ptr = ptr -> next; } return start; } //sorting linked list code struct node *sort_list(struct node *start) { struct node *ptr1, *ptr2; int temp; ptr1 = start; while(ptr1 -> next != NULL) { ptr2 = ptr1 -> next; while(ptr2 != NULL) { if(ptr1 -> data > ptr2 -> data) { temp = ptr1 -> data; ptr1 -> data = ptr2 -> data; ptr2 -> data = temp; } ptr2 = ptr2 -> next; } ptr1 = ptr1 -> next; } return start; // Had to be added }

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