void change_add() { // unsigned int a = 0xFFFFFFF7; unsigned char i = (unsigned char)a; char *b = (char *)&a; //此处将a的地址赋值给b,强制使得b的地址指向a而已, printf("%08x,%08x\n",i,*b);//还有一个区别,就是b指针的+1跨度是sizeof(char),而a是uint 跨度是sizeof(uint) cout<<"================\n"; printf("&b=%x, &a = %x\n",b,&a); printf("b+1=%x ,&a+1 = %x\n",b+1,&a+1); }
不同类型的指针,影响指针的寻址