Avoiding "assignment from incompatible pointer type" warning

Steve Dondley s@dondley.com
Sun Oct 13 09:08:00 GMT 2002


Hi,

I've written a simple program that print out each bit of a floating point
variable so I can learn how floating point numbers are represented in
memory.  The program contains the following statements:

int *p;
float g = 2.0625;
p = &g;

The third statement above generates an "assignment from incompatible pointer
type" warning for obvious reasons.  Other than this, the program compiles
fine and works.

My question is:  Is there a way to properly assign a pointer of one type to
a variable of different type so that the warning is suppressed?

Thanks again.




More information about the Gcc-help mailing list