Pointer to An Array in C

Pointer to an Array in C

//Pointer of Array

#include<stdio.h>

main()
{

 int a[5]={1,3,5,7,9},i;      //declare array
 int *p[5];       //pointer of array p

  for(i=0;i<5;i++)
  {

   printf("Value By Array:%d\n",a[i]);

   p[i]=&a[i];

   }
  for(i=0;i<5;i++)
  {

      printf("Value By Array pointer:%d\n",*p[i]);

  }
}



Related Posts