#include <stdio.h>
#include <math.h>
int main()
{
float x, y, *fp, *fp2;
x = 6.5;
printf(“Value of x is %f, address of x %ld\n”, x, &x);
fp = &x;
printf(“Value in memory location fp is %f\n”, *fp);
*fp = 9.2;
printf(“New value of x is %f = %f \n”, *fp, x);
*fp = *fp + 1.5;
printf(“Final value of x is %f = %f \n”, *fp, x);
y = *fp;
fp2 = fp;
printf(“Transfered value into y = %f and fp2 = %f \n”, y, *fp2);
return 0;
}
compiled and executed it:
$ ./testfloat
Value of x is 6.500000, address of x 140734612936552
Value in memory location fp is 6.500000
New value of x is 9.200000 = 9.200000
Final value of x is 10.700000 = 10.700000
Transfered value into y = 10.700000 and fp2 = 10.700000
o–kay ?? why did I have that on my server.