Skip to main content

Array pointers arithmetic in c

#include<stdio.h>
int main() {
int arr []={1,4,5,9,7,6};
printf("The value of array at position 3 is %d\n",arr[3]);
printf("The address of first element of array is %d\n",&arr[0]);
printf("The address of first element of array is %d\n",arr);
printf("The address of second element of array is %d\n",&arr[1]);
printf("The address of first element of array is %d\n",arr+1);
printf("The value of address at first element of array is %d\n",*(arr));
printf("The value of address at first element of array is %d\n",*(&arr[0]));
printf("The value of address at second element of array is %d\n",*(&arr[1]));
printf("The value of address at first element of array is %d\n",arr[0]);
printf("The value of address at second element of array is %d\n",*(arr+1));
printf("The value of address at second element of array is %d\n",arr[1]);
return 0;
}

Comments