Quote (ferf @ Sep 21 2020 04:52pm)
is that bad practice leaving nArray with extra slots? if so, how would i adjust it? Thanks again :)
Perhaps, but that's a product of using an array since the size has to be declared and it can't be changed after. You could use any mutable data structure for the second array, one that would allow an .append() function. (For example: a list of chars).
But at a lower level thought process the trade offs are:
Would you rather have a few extra bytes of a primitive data type or would you rather use a larger object to avoid that?
Furthermore, if you include that part of code in a function, once the function reaches its end the array will be removed from memory. So you wouldn't have to worry about that amount of unused array-space taking up space in memory.This post was edited by Kippet on Sep 21 2020 06:42pm