4 ms·
Surely 2 * (capacity + 1) = 2 * capacity + 2
by anonymoushn 3y ago
Surely 2 * (capacity + 1) = 2 * capacity + 2
- jltsiren 3y agoThat is the new allocation size. The new capacity is one character less. The allocation must include space for the trailing 0, which is not a part of the string and is hence not included in the length/capacity numbers.
- anonymoushn 3y agoI see, thanks for your patience :)
- ace2358 3y agoGreat thread, I was scratching me head a bit too.