Hi. Im new here and this is my first post, I hope you can help me with this problem I have: I'm trying to understand how the machine is working with different types of data (char, int, float, double, etc). So I made a program to see the bit representation for char and integers by using the bitwise operators. For example this is my function to see the binary representation of an integer:
Now my problem is that it doesn't work for floats or doubles, (I try to change the type of data received by the funcion but it doesnt work, I don't know why. I'm I doing something wrong?). Any idea about how can I make a function to see the bit representation of kind double or float? Thanks so much for your help.
for 'double' is the same, the difference is that double has 64 bits. However, you should know the floating-point specifics of the IEEE754 for the floating-point number rappresentation: http://en.wikipedia.org/wiki/IEEE_754-2008