I had the following code :
#include<stdio.h> void main() { int * a; int arr[2]; arr[1] = 213 ; arr[0] = 333 ; a = &arr ; printf("\narr %d",arr); printf("\n*arr %d",*arr); printf("\n&arr %d",&arr); printf("\n%d",a[1]); } On running this simple program i get the output as follows :
arr -1079451516 *arr 333 &arr -1079451516 213 Why is it that both arr and &arr give the same result ? I can understand that arr is some memory location and *arr or arr[0] is the value stored at the position, but why is &arr and arr same ?
%pand cast tovoid*rather than%d.