online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code    Language
public class Main { public static void main(String[] args) { int[] stackI = {0, 0, 0, 0, 0}; System.out.println( "stackI.length=" + Integer.toString(stackI.length) ); System.out.println( "---------------------" ); PushStack(stackI, 2023); PushStack(stackI, 9); PushStack(stackI, 23); PushStack(stackI, 14); PushStack(stackI, 11); PushStack(stackI, 22); PushStack(stackI, 33); PopStack(stackI); PopStack(stackI); PushStack(stackI, 44); PushStack(stackI, 55); PopStack(stackI); PopStack(stackI); PopStack(stackI); PopStack(stackI); PopStack(stackI); } static void PushStack(int[] argStack, int argNew) { int arrSize = argStack.length; if(argStack[arrSize-1]!=0) { System.out.println( "(PushStack) STACK IS ALREADY FULL (argNew=" + Integer.toString(argNew) + ")" ); return; } for(int arrIdx=0; arrIdx<arrSize; arrIdx++) { if(argStack[arrIdx]>0) { continue;/*해당 층은 이미 투숙객이 있으니 윗층으로*/ } argStack[arrIdx]=argNew; System.out.println( "(PushStack) new TOP [" + Integer.toString(arrIdx) + "]=" + Integer.toString(argStack[arrIdx]) ); break; } } static int PopStack(int[] argStack) { int result = 0; int arrSize = argStack.length; if(argStack[0]==0) { System.out.println( "(PopStack) STACK IS EMPTY!!!" ); return argStack[0]; } for(int arrIdx=arrSize-1; arrIdx>=0; arrIdx--) { if(argStack[arrIdx]==0) { continue;/*해당 층은 이미 빈방이다.*/ } argStack[arrIdx]=0; arrIdx = arrIdx-1; if(arrIdx<=0){ arrIdx=0; } System.out.println( "(PopStack) new TOP [" + Integer.toString(arrIdx) + "]=" + Integer.toString(argStack[arrIdx]) ); break; } return result; } }

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