online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code    Language
#include<stdio.h> int main() { int i, n, arr[10],j, p,tmp; //ask user for number of elements of list printf("Enter the number of elements: "); scanf("%d",&n); //get the list of elements printf("Enter %d elements : ", n); for(i = 0; i < n; i++) { scanf("%d",&arr[i]); } //loop each element of list for(i = 1; i < n; i++) { //get current variable in tmp j = i; //loop while value is greater than 0 and left side value is greater than right side value //then you should interchange the values using temp while ( j > 0 && arr[j-1] > arr[j]) { tmp = arr[j]; arr[j] = arr[j-1]; arr[j-1] = tmp; j--; } } printf("The sorted elements are : "); for(i = 0; i < n; i++) { printf("%d ",arr[i]); } return 0; }

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