online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code   
Language
#include <stdio.h> #include <inttypes.h> struct data_packet{ char identifier[8]; char command[8]; uint8_t arg1; uint8_t arg2; }; #define INPUT_STR "<<< id01 switch 0xAB29 >>>" struct data_packet parse_input(char *input){ //uint8_t exit_code = 1; struct data_packet packet; uint8_t conversions = 0; uint16_t args = 0; conversions = sscanf(input , "<<< %s %s %x >>>", packet.identifier, packet.command, &args); packet.arg1 = (args >> 8); // High Byte of args packet.arg2 = (args & 0x00FF); //Low byte of args //if (conversions == 3) exit_code = 0; //return exit_code; return packet; } int main(void){ struct data_packet data = parse_input(INPUT_STR); printf("%s\n", INPUT_STR); printf("identifier: %s\ncommand: %s\narg1: 0x%0x\narg2: 0x%0x\n", data.identifier, data.command, data.arg1, data.arg2); 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