#include <stdio.h>
int main(void)
{
double x = 1.1, y;
int *p;
/* assign p (an integer pointer) to point to a double. */
p = (int *) &x;
/* The next statement does not operate as expected. */
y = *p; /* attempt to assign y the value x through p */
/* The following statement won't output 1.1. */
printf("The (incorrect) value of x is: %f", y);
return 0;
}
|