Why did we allocate an array of size 12 for our representation of that int as a string? No worries if the reason’s non-obvious, but give some though as to how wide the most positive (or most negative!) int might be.
What does that means?
Why did we allocate an array of size 12 for our representation of that int as a string? No worries if the reason’s non-obvious, but give some though as to how wide the most positive (or most negative!) int might be.
What does that means?
The question is hinting at you to think about why the array is initialized with a size of 12.
An integer, given how it is represented in computer memory on 32 bit systems (such as the appliance), has a finite value. Affording for the '/n' character at the end of a string results in a maximum width of 12 characters for the integer -(231) and 11 characters for 231-1.