Confusion on array definition at Arduino website See the below explanation about Arrays from Arduino's official site:


  Creating (Declaring) an Array
  
  All of the methods below are valid ways to create (declare) an array.

  int myInts[6];
  int myPins[] = {2, 4, 8, 3, 6};
  int mySensVals[6] = {2, 4, -8, 3, 2};
  char message[6] = "hello";

  
  You can declare an array without initializing it as in myInts.
  
  In myPins we declare an array without explicitly choosing a size. The
  compiler counts the elements and creates an array of the appropriate
  size.
  
  Finally you can both initialize and size your array, as in mySensVals.
  Note that when declaring an array of type char, one more element than
  your initialization is required, to hold the required null character.


I have the following problems to understand:


Isn't int mySensVals[6] = {2, 4, -8, 3, 2}; wrong? I count 5 elements.
Isn't char message[6] = "hello"; is wrong as well? I count 5 elements.
1-) Isn't int mySensVals[6] = {2, 4, -8, 3, 2}; wrong? I count 5 elements.


No, not wrong at all. There are 6 elements (as the definition says), and the first five are set to 2, 4, -8, 3 and 2. The sixth is undefined.


  2-) Isn't char message[6] = "hello"; is wrong as well? I count 5 elements.


No. There are 6 there. To quote your quote:


  Note that when declaring an array of type char, one more element than your initialization is required, to hold the required null character.


So "hello" is actually "hello\0".