have to write a program using pointers that outputs the binary bit pattern of double variable entered by the user.
not using that bitwise functions, only %26lt;stdio.h%26gt; or %26lt;math.h%26gt; if needed.
please explain the logic only
.
i have done it for int and float, the problem with double is i cannot read the double memory as integer because double is 64 bit.|||You can read double memory as an array of smaller types (char, integer), or as a single long. The latter is probably the easier way. It's maybe less portable (I don't think it is guaranteed that long and double have the same size on every platform) but that probably doesn't matter for this exercise.
Take your previously working program, and change the float to a double, and the int* to a long*.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment