c - How does below method of array intialization differ in context to array bounds checking? -
why int arr[2]={10,20,30,40,50}
leads error? why can't initialization escape error array bound checking?
int arr[2] ; arr[0]=10, arr[1]=20, arr[3]=30, arr[4]=40;
doesn't cause error in context c language array bound checking ?
there no runtime array bounds check in c. free obliterate whatever in memory. 1st example show, compile-time structure, compiler know declared array of size 2, , initialization has > 2 elements.
Comments
Post a Comment