online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code    Language
#include<stdio.h> void railwayTimeConversion(char x[20]){ char m = x[8]; if(m=='A'){//This works for AM int a = x[0]-'0'; int b = x[1]-'0'; int c = (a*10)+b; if(c==12){ printf("00:"); for(int i=3;i<8;i++){ printf("%c",x[i]); } } else{ for(int i=0;i<8;i++){ printf("%c",x[i]); } } } else{//This works for PM if(x[0]=='1' && x[1]=='2'){ for(int i=0;i<8;i++){ printf("%c",x[i]); } } else{ int a = x[0]-'0'; int b = x[1]-'0'; int c = (a*10)+b; int h = c+12; printf("%d",h); for(int i=2;i<8;i++){ printf("%c",x[i]); } } } } int main(){ char x[20]; scanf("%s",x); railwayTimeConversion(x); 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