a question about arrays

Posted By: NITRO777

a question about arrays - 04/22/11 16:55

Hello,
I was just experimenting with arrays and noticed that after ths code:
Code:
var array_test[2][9];
array_test[1][1]= 1;
array_test[2][10]=4;



The engine still works with fine with this,but I would expect an error, isn't the array out-of-bounds at [2][10]? Why will it still accept data at that location?

Posted By: Myrkling

Re: a question about arrays - 04/22/11 17:07

Lite-C doesn't have bounds checking, so by writing to invalid indices adjacent memory is overwritten.
This can cause random crashes (depending on what is overwritten).
Posted By: NITRO777

Re: a question about arrays - 04/22/11 17:17

thanks
© 2024 lite-C Forums