- Elements of an array are stored in consecutive memory locations.
- The name of an array is a constant pointer that points to the
first element of the array, i.e. it stores the address of the first
element, also know as the base address of array.
- According to pointer arithmetic, when a pointer variable is
incremented, it points to the next location of its base type
#include<stdio.h>
main()
{
int arr[5] = {5,10,15,20,25};
int i;
for(i=0; i<5; i++)
{
printf(“Value
of arr %d= %d\t”, i, arr[i]);
printf(“Address
of arr %d = %u\n”,i,&arr[i]);
}
}
0 Comment "With example program elucidate about pointers and one dimensional array."
Post a Comment