online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code   
Language
//Selection Sort #include <stdio.h> int comp_cnt=0; int main() { int a[20], n , i; printf("\t>>Selection Sort<<\n"); printf("How many numbers you want in array ?\t"); scanf("%d",&n); printf("\nEnter %d element:",n); accept(a,n); selection_sort(a,n); printf("\t>>Sorted Array<<\n"); display(a,n); printf("\nTotal number of comparisons = %d", comp_cnt); return 0; } void accept(int a[], int n) { int i; for(i=0; i<n; i++) scanf("%d", &a[i]); } void display(int a[], int n) { int i; for(i=0; i<n; i++) printf("%d\t",a[i]); } void selection_sort(int a[], int n) { int i, temp, current, pos, smallest; for(current=0; current<n-1; current++) { smallest = a[current]; pos = current; for(i=current+1; i<=n-1; i++, comp_cnt++) if(a[i] < smallest) { smallest = a[i]; pos = i; } temp = a[current]; a[current] = a[pos]; a[pos] = temp; } }

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