Translate

Labels

Sunday 16 June 2013

PROGRAM TO STORE A FLOAT VALUE IN THE MEMORY

#include<malloc.h>
main()
{
float *fp;
fp=(float*)malloc(sizeof(float));
/*Initialization of pointer variable*/

printf("The address of the memory allocated :%u\n",fp);
printf("Enter a float value:\n");
scanf("%f",fp);
printf("the value stored:%.2f\n",*fp);
}

OUTPUT:

The address of the memory allocated:4201148
Enter a float value:8.5
The value stored:8.50 

No comments: