online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code    Language
/****************************************************************************** Welcome to GDB Online. GDB online is an online compiler and debugger tool for C/C++. Code, Compile, Run and Debug online from anywhere in world. *******************************************************************************/ #include <stdio.h> void BubbleSort(int items[], int length); void PrintArray(int items[],int length) { printf("\n"); for(int i=0; i < length; i++) { printf("%d ",items[i]); } } int main() { int items[] = {1,4,5,22,11,3}; printf("Before sorting\n"); PrintArray(items,6); printf("\n**********************\n"); BubbleSort(items,6); printf("\n**********************\n"); printf("after sorting\n"); PrintArray(items,6); return 0; } void BubbleSort(int items[], int length) { //iterate from first item (index 0) till 2nd last for(int i=0; i<length-1;i++) { //iterate from first item(index 0) till length-(i+1) for(int j=0; j<length-i-1;j++) { if(items[j] > items[j+1]) { printf("\n swapping between %d and %d",j, j+1); items[j]= items[j] ^ items[j+1]; items[j+1] = items[j] ^ items[j+1]; items[j] = items[j] ^ items[j+1]; PrintArray(items,6); } } } }

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