csapp 练习2.60
#include #include typedef unsigned char * byte_pointer; unsigned replace_byte(unsigned x,unsigned char b,int i); int main() { unsigned x = 0x12345678; unsigned char b =0xab; int i = 0; scanf("%d",&i); printf("%x",replace_byte(x,b,i)); return 0; } unsigned replace_byte(unsigned x,unsigned char b,int i) { unsigned temp = x; byte_pointer start = &temp; start[i] = b; return temp; }