online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code    Language
def generate_option_61(client_id): # Option 61 format: <type><length><value> # Type: 1 byte, Length: 1 byte, Value: variable length option_type = b'\x3d' # Option 61 type (Client Identifier) option_length = bytes([len(client_id) + 1]) # Length of client ID + 1 for type option_value = b'\x00' + client_id.encode() # Type (Ethernet) + Client ID return option_type + option_length + option_value # Prompt user to input client ID client_id = input("Enter Client ID (ASCII string, max 255 bytes): ") # Sanity check: Ensure client ID length is less than 255 bytes if len(client_id.encode()) > 254: print("Error: Client ID length exceeds 255 bytes.") exit() # Example usage: option_61 = generate_option_61(client_id) print("Option 61 DHCP Client ID:", option_61.hex())

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