title: Printing array contents to Serial, Giving unexpected values
body: <p>I'm trying to send array contents over Serial. This is the code:</p>
  
  <pre class="lang-c prettyprint-override"><code>    #include &lt;PCM.h&gt;
      const unsigned char sample[] PROGMEM = {
      126, 127, 128, 128, 128, 128, 128, 127, 128, 128, 128, 129, 129, 128, 127, 128, 128, 127, 126, 127, 128, 129, 128, 127, 126, 127, 128, 128, 126, 126, 127, 127, 127, 127, 127, 127, 126, 127, 129, 130, 129, 128, 126, 126, 126, 126, 127, 129, 130, 129, 127, 127, 127, 127, 128, 128, 128, 128, 127, 127, 127, 127, 127, 127, 128, 130, 131, 129, 127, 126, 126, 126, 127, 127, 128, 128, 128, 128, 127, 128, 128, 127, 127};
  
  void setup()
  {
  Serial.begin(115200);
  
  delay(3000);
  for (int i=0; i&lt;sizeof(sample); i++)
  {
  delay(100);
  Serial.println(sample[i]);
  }
  }
  
  void loop()
  {
  }
  </code></pre>
  
  <p>When I start monitoring serial port, it gives non-intended output, not the original values inside the array.
  This is the Output of the first code "with Println":</p>
  
  <pre><code>0
  0
  6
  0
  0
  0
  1
  0
  0
  6
  6
  6
  6
  6
  6
  6
  0
  0
  135
  0
  0
  6
  0
  0
  1
  3
  0
  6
  171
  0
  0
  0
  0
  0
  0
  0
  6
  6
  6
  6
  6
  6
  6
  6
  6
  6
  6
  6
  6
  6
  6
  6
  6
  6
  6
  6
  6
  6
  6
  6
  6
  6
  6
  6
  6
  6
  6
  6
  6
  6
  2
  6
  1
  4
  45
  0
  0
  6
  0
  6
  0
  248
  254
  </code></pre>
  
  <p>This is the output with "Write":
  <a href="http://i.stack.imgur.com/FjoaQ.jpg" rel="nofollow">i could not paste the output of "write", i captured it as jpg</a></p>
  
  <p>But, when I do this, I get the values I want , but I'll lose the FOR loop,</p>
  
  <pre class="lang-c prettyprint-override"><code> #include &lt;PCM.h&gt;
  
   const unsigned char sample[] PROGMEM = {
   126, 127, 128, 128, 128, 128, 128, 127, 128, 128, 128, 129, 129, 128, 127, 128, 128, 127, 126, 127, 128, 129, 128, 127, 126, 127, 128};
   void setup()
   {
   Serial.begin(115200);
   delay(3000);
   //for (int i=0; i&lt;sizeof(sample); i++)
  // {
   delay(100);
   Serial.println(sample[0]);
   Serial.println(sample[1]);
   Serial.println(sample[2]);
   Serial.println(sample[3]);
   Serial.println(sample[4]);
  // }
   }
   void loop()
   {
   }
  </code></pre>
  
  <p>What is the problem? 
  I could not figure it out.
  Any help will be appreciated.</p>
  
  <p>NOTE: Both codes should give same result for the first 5 values in the array, but it did not, the second code gives "126 127 128 128 128" and it is good, but the first code wont, and it has an only difference of having the variable "i" instead of listing all contents of the array one by one.</p>
  
  <p>Thank you in advance,</p>