C Program to Display Value & Address of Variable of Type Float Using Pointer
Question: write a program in C to display value and address of normal variable of type float using pointer.
C Source Code: Display Value & Address Using Pointer
#include<stdio.h>
int main()
{
/* Declaration of normal & pointer variable */
float var, *ptr;
/* Setting some value to normal variable */
var = 23.32;
/* Pointer referencing */
ptr = &var;
/* Displaying value and address */
printf("Address of var without using pointer = %u\n", &var);
printf("Value of var = %f\n", *ptr);
printf("Address of var using pointer = %u\n", ptr);
return 0;
}
Output
The output of the above program is:
Address of var without using pointer = 6422036 Value of var = 23.320000 Address of var using pointer = 6422036