Raised This Month: $32 Target: $400
 8% 

Array Copy Stock


Post New Thread Reply   
 
Thread Tools Display Modes
xPaw
Retired AMX Mod X Moderator
Join Date: Jul 2008
Old 03-14-2012 , 16:43   Re: Array Copy Stock
Reply With Quote #31

Quote:
Originally Posted by Exolent[jNr] View Post
Loop until the plugin breaks at a runtime error of "index out of bounds" ?
Good one.
I approve
__________________
xPaw is offline
Old 03-15-2012, 07:35
hleV
This message has been deleted by hleV.
Tirant
Veteran Member
Join Date: Jul 2008
Location: Los Angeles, California
Old 03-15-2012 , 14:13   Re: Array Copy Stock
Reply With Quote #32

Ya, that's why you should test code before posting. It would also not be able to work on an array with data less than equal 0.

Use arrayset(array, value, size)
arrayset(array2, array1[0], sizeof array2);
Precondition that sizeof array1 <= array2.
__________________

PM me if you're interested in buying the Credits addition for Base Builder
Battlefield Rebirth [66% done]
Call of Duty: MW2 [100% done]
Base Builder [100% done]
Tirant is offline
G[o]Q
Member
Join Date: Jan 2010
Location: Poland (Malopolska)
Old 03-30-2012 , 16:50   Re: Array Copy Stock
Reply With Quote #33

Quote:
Originally Posted by Exolent[jNr] View Post
Loop until the plugin breaks at a runtime error of "index out of bounds" ?
Good one.
if you don't belive me then try

you can try it in Pawn or other languages: C++,C# etc.
G[o]Q is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 03-30-2012 , 17:47   Re: Array Copy Stock
Reply With Quote #34

You don't understand.

Code:
new array[3]; for(new i = 0; i < 10; i++) {     log_amx("%d", array[i]); }

That will produce a runtime error of "index out of bounds" when i equals 3 since it isn't within the index range for the array.
Exolent[jNr] is offline
Tirant
Veteran Member
Join Date: Jul 2008
Location: Los Angeles, California
Old 03-30-2012 , 21:27   Re: Array Copy Stock
Reply With Quote #35

Quote:
Originally Posted by Exolent[jNr] View Post
You don't understand.

Code:
new array[3]; for(new i = 0; i < 10; i++) { log_amx("%d", array[i]); }


That will produce a runtime error of "index out of bounds" when i equals 3 since it isn't within the index range for the array.
+1
__________________

PM me if you're interested in buying the Credits addition for Base Builder
Battlefield Rebirth [66% done]
Call of Duty: MW2 [100% done]
Base Builder [100% done]
Tirant is offline
Old 10-09-2012, 07:14
josephpeter1
This message has been deleted by asherkin. Reason: Spam.
Tirant
Veteran Member
Join Date: Jul 2008
Location: Los Angeles, California
Old 10-09-2012 , 07:23   Re: Array Copy Stock
Reply With Quote #36

Quote:
Originally Posted by josephpeter1 View Post
Have you encountered any situation where you quickly wanted to convert your array to ArrayList or ArrayList to array ?Array BioPharma Inc., a discovery research company, creates drug candidates.
Amxx pawn doesn't directly support dynamic memory allocation. You would need to implement the cell array structure, which I believe is an array list . I don't know of any real fast way other than copying each element iteratively. It would definitely be easier in another language like java or c, but you wouldn't need to then (since an array list is still an array). In java you can just return the array copy (System.arraycopy or Arrays.copyRangeOf), in c just get a pointer and length. But if your making a new copy, just make a new array and copy iteratively.
__________________

PM me if you're interested in buying the Credits addition for Base Builder
Battlefield Rebirth [66% done]
Call of Duty: MW2 [100% done]
Base Builder [100% done]
Tirant is offline
Reply



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 22:51.


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