Raised This Month: $ Target: $400
 0% 

[Solved]Index out of bounds


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 07-13-2010 , 18:38   Re: Index out of bounds
Reply With Quote #8

Quote:
Originally Posted by Alucard^ View Post
I think fysiks wanted to say "<"

PHP Code:
for(new 0;sizeof (Restrts);i++) 
You have to remember that the last number of the array size is null... so if you use "<=" you use Restrts[9] and you should use at Restrt[8] (9 is null).
An array is sized with the number specified but elements are accessed with indexes starting at 0. The last element being null is really only with null terminated strings. Index out of bounds is telling you that your trying to reference memory that doesn't exist. If you size the array at 8 then the last element is 7.
__________________

Last edited by Bugsy; 07-13-2010 at 18:41.
Bugsy is offline
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 07:13.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode