深入理解计算机系统 2.60

来源:互联网 发布:水果软件可以录歌吗 编辑:程序博客网 时间:2024/06/09 15:01


//设置无符号整形的字节,x表示无符号整数,b表示要设置为的字节,i表示设置哪个字节

unsigned replace_byte (unsigned x,unsigned char b,int i)

{

  char *p=(char *)&x;            //利用char指针指向

  p[i]=b;

  return x;

}


0 0
原创粉丝点击