Why is the last element not 7
int array[3];
int *ary;
ary=array;
array[0]=0;
array[1]=0;
array[2]=0;
array[3]=44;
for (int i=0;i<4;i++)
{
cout<<array[i];
}
cout<<endl;
*(ary+0)=1;
*(ary+1)=0;
*(ary+2)=0;
*(ary+3)=7;
for (int i=0;i<4;i++)
{
cout<<array[i];
}
cout<<endl;
Output
00044
1003<-----------------Why 3 and not 7!!!!!!