program to find memory locations of array elements
#include<stdio.h> main() { int a[5]={12,32,22,14,54},i,n; int bit,num; n=sizeof(a)/sizeof(a[0]); for(i=0;i<n;i++) { printf("a[%d]=%d at %u\n",i,a[i],&a[i]); num=a[i]; bit=31; while(bit>=0) { num&(1<<bit)?printf("1"):printf("0"); bit--; } printf("\n"); //printf("a[%d]=%d at %u\n",i,a[i],&a[i]); } }OutPut:
a[0]=12 at 4080586848 00000000000000000000000000001100 a[1]=32 at 4080586852 00000000000000000000000000100000 a[2]=22 at 4080586856 00000000000000000000000000010110 a[3]=14 at 4080586860 00000000000000000000000000001110 a[4]=54 at 4080586864 00000000000000000000000000110110