Search This Blog

Thursday, October 13, 2011

Write a program to book space in the memory for array and display the address of each element

   1:  #include<stdio.h>
   2:  #include<conio.h>
   3:  void main()
   4:  {
   5:  float x[]={1.0,2.0,3.0,4.0,5.0,6.0};
   6:  int i;
   7:  float *add;
   8:  for(i=0;i<6;i++)
   9:  {
  10:  add=&x[i];
  11:  printf("Address of x[%d] is: %ld\n",i,add);
  12:  }
  13:  getch();
  14:  }

No comments:

Post a Comment