I need to be sure if the following is true.
If I want to declare an array with just one element in C that would be:
char array[1];
Right? And I would assign a value to it with index 0. For example:
array[0] = 'S';
And there has been no memory storage set aside for array[1]. Even though I declared the array with:
char array[1];
I'm asking because I find it a bit counterintuitive because arrays begin with index 0. So I think that I should declare an array with a single element like this:
char array[0];
and then go ahaead and assign a value like above:
array[0] = 'S';
But through a bit of testing that seems to be wrong to declare an one element array with:
char array[0];