1 Star 0 Fork 0

20145330swx / Linux

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
P24.c 532 Bytes
一键复制 编辑 原始数据 按行查看 历史
swx 提交于 2016-10-02 15:35 . hi
#include <stdio.h>
typedef unsigned char *byte_pointer;
void show_bytes(byte_pointer start,int len){
int i;
for(i=0;i<len;i++)
printf("%.2x",start[i]);
printf("\n");
}
void show_int(int x){
show_bytes((byte_pointer) &x, sizeof(int));
}
void show_float(float x){
show_bytes((byte_pointer) &x, sizeof(float));
}
void show_pointer(void *x) {
show_bytes((byte_pointer) &x, sizeof(void *));
}
void main(){
int a;
printf("input your num:");
scanf("%d",&a);
float b=(float)a;
int *c=&b;
show_int(a);
show_float(b);
show_pointer(c);
}
1
https://gitee.com/20145330swx/Linux.git
git@gitee.com:20145330swx/Linux.git
20145330swx
Linux
Linux
master

搜索帮助