title: C arrays and null byte
body: <p>I have a question for better understing how arrays and nullbytes work in C.</p>
  
  <p>Let's say I have an int array of 13 cells.
  Let's say I want cells number: 1, 2, 3 and 10 to have a value. The others that are left as default, automatically get the nullchar \0 as value ?</p>
  
  <p>My understanding of \0 was that the nullbyte is always at the end of the array and its function is to tell the program where array ends. But seems to be wrong</p>
  
  <p>I wrote a simple prog to verify that and seems it is like that:</p>
  
  <pre><code>int nums[13] = {1,2,3};
  nums[10] = 69;
  int i;
  for(i=0;i&lt;13;i++) {
      if(nums[i]=='\0') {
          printf("null char found! in position: %d\n",i);
      }
      else {
          printf("element: %d found in position: %d of int array\n",nums[i],i);
      }
  }
  
  return 0;
  </code></pre>
  
  <p>here is the output:</p>
  
  <p>element: 1 found in position: 0 of int array</p>
  
  <p>element: 2 found in position: 1 of int array</p>
  
  <p>element: 3 found in position: 2 of int array</p>
  
  <p>null char found! in position: 3</p>
  
  <p>null char found! in position: 4</p>
  
  <p>null char found! in position: 5</p>
  
  <p>null char found! in position: 6</p>
  
  <p>null char found! in position: 7</p>
  
  <p>null char found! in position: 8</p>
  
  <p>null char found! in position: 9</p>
  
  <p>element: 69 found in position: 10 of int array</p>
  
  <p>null char found! in position: 11</p>
  
  <p>null char found! in position: 12</p>
  
  <p>| 1 | | 2 | | 3 | | \0 | | \0 | | \0 | | \0 | | \0 | | \0 | | 69 | | \0 | | \0 | | \0 |</p>
  
  <p>So why default cells are set with the \0 value ? instead of being left empty for example ?</p>
  
  <p>Shouldn't the null char be just once at the end of the entire array ?
  Thanks</p>