Problem with array

I am looking for an explaination for the following code

int next[5] = {20,30,40,50,60};// works correctly next[5] ={020,030,040,050,060} prints out incorrectly
void setup() {
Serial.begin (9600);}
void loop(){
int i;
for (i = 0;i<5; i++){
Serial.println (next*);*

  • }*
  • while(1);*
  • }*
  • When next(5) is printed out, I get 20,30,40,50,60*
    But when I change next(5) to 020,030,040,050,060 The printout is 16,24,32,40, and 48 multiples of 8.
    The program seems to treat 020 as a binary number? Do I need to declare the numbers in the array in some way?

how important is it to have a leading 0? could you try the same thing but lead iwth a 1? it could be a variable size limit.

The leading 0 is the prefix for Octal, base 8.

  1. Use the code tag when posting your code (the # sign in the buttons above the text window you type in)

  2. as written your code won't work because the serial.print(next) doesn't reference which element of the array you will be printing.

  3. Try using Serial.println(next*, OCT); with the other next declaration you were having problems with and see what happens.*

Many thanks. Leading 0 makes the number octal.