Sunday, 11 December 2011

write a program to find address of integer and float number in c

#include
#include
void main()
{
int i,*iptr;
float f,*fptr;
clrscr();
printf("Enter an integer number:");
scanf("%d",&i);
printf("Enter a float number:");
scanf("%f",&f);
iptr=&i;
fptr=&f;
printf("\nThe address of integer variable is %u",iptr);
printf("\nThe value of integer variable is %d",i);
printf("\nThe value of the integer variable using pointer is%d\n",iptr);
printf("\nThe address of float variable is %u\n",fptr);
printf("The value of float variable is %f\n",f);
printf("The value of the float variable using pointer is%.2f\n",*fptr);
getch();
}

OUTPUT
Enter an integer number:55
Enter a float number:55.5

The address of integer variable is 65524
The value of integer variable is 55
The value of the integer variable using pointer is 55

The address of float variable is 65520
The value of float variable is 55.500000
The value of the float variable using pointer is 55.50

No comments:

Post a Comment