Hi!
I was wondering what the most space efficient way to store strings was? Can you only put them in an array or is there something better?
Thank-you.
Hi!
I was wondering what the most space efficient way to store strings was? Can you only put them in an array or is there something better?
Thank-you.
Well, obviously this isn't so efficient:
char String[1024] = "Hello world!";
It's a waste of 1011 bytes...
Instead use:
char String[] = "Hello world!";
or:
char* String = "Hello world!";
Or use dynamic allocation if you don't know the strings length.
MagosX.com
Give a man a fish and you feed him for a day.
Teach a man to fish and you feed him for a lifetime.