online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code   
Language
//CREATE & TRAVERSAL #include<stdio.h> #include<stdlib.h> typedef struct node { int info; struct node *left, *right; }NODE; //TREE FUNCTION NODE * createbst(NODE *root) { NODE *newnode, *temp, *parent; int i, n, num; printf("\nHow many nodes you want to enter?\t"); scanf("%d", &n); for(i=1; i<=n; i++) { newnode = (NODE*)malloc(sizeof (NODE)); printf("Enter the %d elements:\t", n); scanf("%d", &num); newnode->info=num; newnode->left = newnode->right = NULL; if(root == NULL) { root = newnode; continue; } temp = root; while(temp != NULL) { parent = temp; if(num < temp->info) temp = temp->left; else temp = temp->right; } if(num < parent->info) parent->left = newnode; else parent->right = newnode; } return(root); } // Traversal Function void preorder(NODE * root) { NODE *temp = root; if(temp != NULL) { printf("%d\t", temp->info); preorder(temp->left); preorder(temp->right); } } void inorder(NODE * root) { NODE *temp = root; if(temp != NULL) { inorder(temp->left); printf("%d\t", temp->info); inorder(temp->right); } } void postorder(NODE * root) { NODE *temp = root; if(temp != NULL) { postorder(temp->left); postorder(temp->right); printf("%d\t", temp->info); } } void main() { NODE *root=NULL; printf("\t>>CREATE & TRAVERSAL<<\n"); root = createbst(root); //Recursive Traversal printf("\nPerorder traversal is:\t"); preorder(root); printf("\nInorder traversal is:\t"); inorder(root); printf("\nPostorder traversal is:\t"); postorder(root); }

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