I have a variable with type double and I want to set it with a integer value.
For example:
double x;
In GDB, when I do :
set x = 14
p x
$1 = 14 //ok, looks right
x/xg &x
0x7fffffffec28: 0x402c000000000000 //oh no, this is a double representation and I want integer!
What I want is to x have an integer value x = 0xe instead of a double representation even if the variable is a double.
Thanks in advance!
You can cast the type of the memory location:
p {int}&x=10
$4 = 10
x/xg &x
0x7f2c40 <x>: 0x000000000000000a
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With