Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Print variables in hexadecimal or decimal format

Tags:

gdb

People also ask

How do you print hexadecimal?

To print integer number in Hexadecimal format, "%x" or "%X" is used as format specifier in printf() statement. "%x" prints the value in Hexadecimal format with alphabets in lowercase (a-f). "%X" prints the value in Hexadecimal format with alphabets in uppercase (A-F).

How do you write hex in C++?

Hexadecimal uses the numeric digits 0 through 9 and the letters 'a' through 'f' to represent the numeric values 10 through 15). Each hex digit is directly equivalent to 4 bits. C++ precedes a hexadecimal value that it prints with the characters "0x" to make it clear that the value is in base 16.

What is display GDB?

Enables automatic displaying of certain expressions each time GDB stops at a breakpoint or after a step.


Sure it is. Try these:

# Hexadecimal
p/x variable

# Binary
p/t variable

See output formats.