If we declare an array of characters in C
Ex:
char label[] = "Hello";
We will have an array in memory which looks like this
--------------------------
| H | e | l | l | o | \0 |
--------------------------
where the extra null byte is added at the end of the array.
Scenario 1:
char label[10] = "Hello";
------------------------------------------
| H | e | l | l | o | \0 | | | | |
------------------------------------------
where it will have an extra 4 unused locations.
Scenario 2:
Here if we have exactly a string with 10 characters, will the \0 (null byte) still be added, which makes the char array to hold 11 characters?
char label[10] = "0123456789";
-----------------------------------------
| 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |
-----------------------------------------
OR
----------------------------------------------
| 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | \0 |
----------------------------------------------