c code

 1 #include <stdio.h>
 2 typedef unsigned char * byte_pointer;
 3 
 4 void show_bytes(byte_pointer start,int len)
 5 {
 6     int i;
 7     for(i=0;i<len;i++)
 8         printf(" %.2x",start[i]);
 9     printf("\n");
10 }
11 
12 void show_int(int x)
13 {
14     show_bytes((byte_pointer)&x,sizeof(int));
15 }
16 
17 void show_float(float x)
18 {
19     show_bytes((byte_pointer)&x,sizeof(float));
20 }
21 
22 void show_pointer(void *x)
23 {
24     show_bytes((byte_pointer)&x,sizeof(void *));
25 }
26 int main()
27 {
28 //    int val=3510593;
29      float val=3510593.0;
30 //    show_int(val);
31      show_float(val);
32 }
原文地址:https://www.cnblogs.com/feng801/p/1969133.html