Skip to main content

Try it Live

Run Bytecode examples in the interactive playground

char* bytecode_to_hex(bytecode_t bytecode, allocator_t allocator)

Convert bytecode to hex string with 0x prefix.Parameters:
  • bytecode: bytecode_t - Bytecode to convert
  • allocator: allocator_t - Allocator for result string
Returns: char* - Hex string with 0x prefix (must be freed by caller)Example:
#include <voltaire/primitives.h>
#include <stdlib.h>

bytecode_t bc = bytecode_from_hex("0x6001", allocator);
char* hex_str = bytecode_to_hex(bc, allocator);

printf("%s\n", hex_str);  // "0x6001"

free(hex_str);
Defined in: primitives.h

See Also

  • fromHex - Parse hex string to bytecode