![]() |
|
CLEAR - Printable Version +- Boriel Basic Forum (https://forum.boriel.com) +-- Forum: Compilers and Computer Languages (https://forum.boriel.com/forumdisplay.php?fid=12) +--- Forum: ZX Basic Compiler (https://forum.boriel.com/forumdisplay.php?fid=11) +---- Forum: Wishlist (https://forum.boriel.com/forumdisplay.php?fid=14) +---- Thread: CLEAR (/showthread.php?tid=2339) |
CLEAR - zarsoft - 2023-03-04 How do I clean an ARRAY? I would like to use the function CLEAR. Code: VAR A(3) TYPE INTEGERRE: CLEAR - boriel - 2023-03-06 There is a faster way, use memset: Code: #include <memcopy.bas>Please, try this and tell me if it works. Also, I'm curious: How did you implement ADDRESS(v) and SIZE(v), they can be useful and included in the compiler. (The next version will have changes and will update the standard library). RE: CLEAR - zarsoft - 2023-03-06 I have not implemented these functions. I was hoping you had already implemented them. RE: CLEAR - boriel - 2023-03-06 No. To get the address of an element, you normally use the @ operator. I.e. @a returns the memory address (uInteger) of the [a] variable. For arrays, @arr won't work as expected as it will return the address of the array's metadata. To get the address of the 1st element you will use @arr(0, 0). I will come back with a solution on the size, but it might be not that strightforward. RE: CLEAR - zarsoft - 2023-03-06 CLEAR an array would be very useful. |