BOUNDARY OVERFLOW
int main(){
int val[5]={1,2,3,4,5};
val[5] = 100;
printf("%d",val[5]);
return 0;
}
Here val is a 5-elements integer array and the array is
initialized. Next we are trying to assign 100 to val[5] leads to runtime error
- boundary overflow. Since array index begins with 0 and we are trying to
assign or access the 6th element via val[5] but the val is a 5-elements integer
array. This is known as Array Index Out of Bounds error.
No comments:
Post a Comment