dynamic char array

This is a discussion on dynamic char array within the C++ Programming forums, part of the General Programming Boards category; Code:
char file[11];
That uses 24 bytes. I am not happy about that when I will be having it in ...

> How do I create a dynamic array that starts of at a minimal size
Which is likely to take up more space, since dynamic memory has overheads which statically allocated memory does not (for example, space for the pointer).
Not to mention all the admin overhead of the heap manager.

In debug builds, the compiler usually inserts padding "DMZ's" around arrays in particular to help trap your array overrun code.

Even in release builds, memory will be allocated so as to preserve performance enhancing memory alignment restrictions.

I think you need to stop worrying so much about where every single byte is going, and focus more on the actual problems to be solved.

There's no way on earth I'm doing 20 * 80 of char file[11]; no ........ing way. Reason is that the array exists for the potential to add a filename...there may be only one tile on the board which links to another board. It's cheaper to waste 4 bytes * 80 * 20 than 12 bytes.

Dude, what are you worrying about? That's only 17.1875kb of memory, hardly a scratch on the surface of most people's RAM nowadays. You should be more worried about memory when you start bumping up to the megabytes being used.