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++, Python, PHP, Ruby, C#, VB, Perl, Swift, Prolog, Javascript, Pascal, HTML, CSS, JS Code, Compile, Run and Debug online from anywhere in world. *******************************************************************************/ #include <stdio.h> char decisions(char choice, int subChoice, char* path1, char* path2) { if(choice == 'A') { printf(path1); subChoice = 0; } else if(choice == 'B') { printf(path2); subChoice = 1; } else { printf("Invalid input. Program terminated."); exit(0); } printf("\n"); return choice, subChoice; } int main() { int monsterHealth; int attackDamage; int subChoice = 0; char choice = 'Z'; char path1[] = "You manage with great effort to pull out the grate, revealing a ladder leading into a dark abyss. You climb down and find yourself on a walkway adjacent to a river with a running current. Do you walk upstream (A) or downstream (B)?"; char path2[] = "You find the door unlocked. You wrench it open and see a long corridor leading to the left, and a winding staircase to the right. Do you go left (A) or right (B)?"; printf("Welcome to Simple Text Adventure! \n"); printf("In this game, you move through rooms in a dungeon, fighting monsters and moving towards the end! \n"); printf("Let us begin! \n"); printf(". \n"); printf(". \n"); printf(". \n"); printf("You awaken on a cold floor in a small and confined room. The walls are made of stone brick. \n"); printf("There is a sewer grate in the corner and a metal-latticed door on the far wall. \n"); printf("Do you attempt to enter the sewer (A) or open the door (B)? \n"); choice = getchar(); decisions(choice, subChoice, path1, path2); printf("Subchoice is:" + subChoice); if(subChoice == 0) { if(choice == 'A') { strcpy(path1, "New message 1"); printf(path1); } else if(choice == 'B') { strcpy(path1, "New message 2"); printf(path1); } } else if(subChoice == 1) { if(choice == 'A') { strcpy(path1, "New message 3"); printf(path1); } else if(choice == 'B') { strcpy(path1, "New message 4"); printf(path1); } } // printf("don't crash pls lol"); // // printf("%s", path1) // // path1 = "1"; // // path2 = "2"; // } // choice = getchar(); // decisions(choice, path1, path2); // printf("wtf"); }

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