为什么将一个浮点型变量强制转换为int *指针会报错

Linux下gcc编译:
求解:
为什么将一个浮点型变量强制转换为int *指针会报错, 但将一个char型变量强制转换为int * 指针则只是warning?

#include
{
 int a = 4;
 float b = 4.2;
 char c = 'A';
 int *p4 = NULL;
 
 p4 = a;          //warning: assignment makes pointer from integer without a cast
 p4 = (int *)a;
 
 p4 = b;          //error: incompatible types when assigning to type ‘int *’ from type ‘double’
 p4 = (int *)b;   //error: cannot convert to a pointer type  
 
 p4 = c;          //warning: assignment makes pointer from integer without a cast
 p4 = (int *)c;   //warning: cast to pointer from integer of different size 

 return 0;
 }

你可能感兴趣的:(强制转换)