I am new to C and I'm getting confused about printing arrays.
Consider this simple code:
char myName [5] = "tamir";
printf("My name is %s" , myName);
The output of this is "tamirH", with extra H at the end.
But when I declare this array like this char myName [6] = "tamir";
(now the array is declared with 6 chars and "tamir" is made out of 5 chars) I don't see the extra "H".
Why is this happening? Is this related to the string terminator in C or am I confused?