CONTEXT
I am studying the array definitions. My question sticks with char array for simplicity. Debian 64bit.
PROBLEM
When I declare those arrays, here is my understanding :
char d[10];
=> I get 10 * 1 byte memory usage.
char d[] = "hellofooo";
=> 9 bytes + '\0' => 10 * 1 byte memory usage
char * d = "hellofooo";
=> 9 bytes + '\0' somewhere in the memory + 8 bytes for the pointer (64 bits)
So, if my understanding is good, we should always prefer the second solution [] to minimise the memory consumption when we do not know upfront the size of the char?
There is no need for pointers in my code. Just trying to find the most ram efficient solution.