I have a few questions regarding string initialization and declaration in C.
Suppose if a I declare a string 's' of size 10 using
char s[10];
Q 1. Is it necessary that all the elements of 's' will be initialized to '\0' or is it just pure luck that I will find other elements to be '\0'?
Q 2. If I instead use malloc to setup a string like this
char *s = malloc(10 * sizeof(char));
Again is it necessary that all the elements will be initialized to '\0'?
Q 3. Further do I need to add an '\0' while declaring the string or not?
char s[10] = "abc";
OR is it has to be
char s[10] = "abc\0";
NOTE: If possible, please take a look at the second answer by Kevin here.