#include <stdio.h>
int main()
{
int i= 0x1122;
char *p;
p=( char *)&i;
if(*p== 0x22)
{
printf( " little!!!!!!\n ");
}
else
printf( " big!\n ");
}
int main()
{
int i= 0x1122;
char *p;
p=( char *)&i;
if(*p== 0x22)
{
printf( " little!!!!!!\n ");
}
else
printf( " big!\n ");
}
warning: assignment from incompatible pointer type
分配 不匹配的指针类型
所以要加强制类型转换:
(char *)