#include //C++ example #include #include //for isprint #include //for frexp using namespace std; void print(int i); void print(char c); void print(double d); int main(int argc, char **argv) { print(atof(argv[1])); return EXIT_SUCCESS; } void print(double d) { int exponent; //uninitialized variable double mantissa = frexp(d, &exponent); cout << d << ", mantissa == " << mantissa << ", exponent == " << exponent << "\n"; for (size_t i = 0; i < sizeof (double); ++i) { cout << static_cast(reinterpret_cast(&d)[i]) << " "; } cout << "\n"; for (size_t i = 0; i < sizeof (double) / sizeof (int); ++i) { cout << hex << reinterpret_cast(&d)[i] << dec << " "; } cout << "\n"; }