online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code    Language
#include<stdio.h> #include<string.h> #define MAX_STR_SIZE 100 void DecidePlace(int n, char element[][MAX_STR_SIZE], const char *letter) { for(int pos=0;pos<n;pos++) if(element[pos][0] == '\0' || element[pos][0] == letter[0]) { strcat(element[pos],&letter[0]); break; } } int main() { int num; int state; int a, b; printf("Enter amount data: "); scanf("%d", &num); int data[num]; char element[num][MAX_STR_SIZE]; for(a=0;a<num;a++) element[a][0]='\0'; for(a=0;a<num;a++) { printf("Enter state: "); scanf("%d", &state); if(state == 3) DecidePlace(num, element, "A"); else if(state == 10) DecidePlace(num, element, "B"); } printf("Elements are: "); for(b=0;b<num;b++) printf(" %s",element[b]); 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