user29345: I have a question about arrays in Arduino. Sorry for my bad English.
I want to put numbers in an array, and I think the code below works properly.
However, it doesn't work and corrupted numbers show up in the Serial monitor. Even delay(1000) doesn't work.
If I change ND_MAC[i]=128; to "ND_MAC[i]=126;", it works properly. So I'm wondering if this array is char type, but I designate int to array.
How to solve it?
int ND_MAC[7];
char i=0;
void setup() {
  Serial.begin(9600);
}
void loop() {
  for(i=0;i<8;i++){
    ND_MAC[i]=128;
    Serial.print(ND_MAC[i],HEX);
  }
  Serial.println();
  delay(1000);
}


user25638: For an array of size 7, the indexes start from 0 (ND_MAC[0]) and end at 6 (ND_MAC[6]) as @MikaelPatel commented. 
So the solution to your issue would be changing the condition in for loop to
for(i=0;i<7;i++) //Changed 8 in your code to 7

Here, the loop iterates from i = 0 to 1 < 7 (i.e., till 6)
and it should work. :)

29345: <p>I have a question about arrays in Arduino. Sorry for my bad English.
I want to put numbers in an array, and I think the code below works properly.</p>

<p>However, it doesn't work and corrupted numbers show up in the Serial monitor. Even <code>delay(1000)</code> doesn't work.</p>

<p>If I change <code>ND_MAC[i]=128;</code> to "ND_MAC[i]=126;", it works properly. So I'm wondering if this array is char type, but I designate int to array.
How to solve it?</p>

<pre><code>int ND_MAC[7];
char i=0;
void setup() {
  Serial.begin(9600);
}
void loop() {
  for(i=0;i&lt;8;i++){
    ND_MAC[i]=128;
    Serial.print(ND_MAC[i],HEX);
  }
  Serial.println();
  delay(1000);
}
</code></pre>
 25638: <p>For an array of size 7, the indexes start from <code>0</code> (<code>ND_MAC[0]</code>) and end at <code>6</code> (<code>ND_MAC[6]</code>) as @MikaelPatel commented. </p>

<p>So the solution to your issue would be changing the condition in for loop to</p>

<pre><code>for(i=0;i&lt;7;i++) //Changed 8 in your code to 7
</code></pre>

<p>Here, the loop iterates from i = 0 to 1 &lt; 7 (i.e., till 6)
and it should work. :)</p>
