Invalid digit 8 in octal constant ошибка

int arr[20][20] = {
                    {08,02,22,97,38,15,00,40,00,75,04,05,07,78,52,12,50,77,91,08},
                    {49,49,99,40,17,81,18,57,60,87,17,40,98,43,69,48,04,56,62,00},
                    {81,49,31,73,55,79,14,29,93,71,40,67,53,88,30,03,49,13,36,65},
                    {52,70,95,23,04,60,11,42,69,24,68,56,01,32,56,71,37,02,36,91},
                    {22,31,16,71,51,67,63,89,41,92,36,54,22,40,40,28,66,33,13,80},
                    {24,47,32,60,99,03,45,02,44,75,33,53,78,36,84,20,35,17,12,50},
                    {32,98,81,28,64,23,67,10,26,38,40,67,59,54,70,66,18,38,64,70},
                    {67,26,20,68,02,62,12,20,95,63,94,39,63,08,40,91,66,49,94,21},
                    {24,55,58,05,66,73,99,26,97,17,78,78,96,83,14,88,34,89,63,72},
                    {21,36,23,09,75,00,76,44,20,45,35,14,00,61,33,97,34,31,33,95},
                    {78,17,53,28,22,75,31,67,15,94,03,80,04,62,16,14,09,53,56,92},
                    {16,39,05,42,96,35,31,47,55,58,88,24,00,17,54,24,36,29,85,57},
                    {86,56,00,48,35,71,89,07,05,44,44,37,44,60,21,58,51,54,17,58},
                    {19,80,81,68,05,94,47,69,28,73,92,13,86,52,17,77,04,89,55,40},
                    {04,52,08,83,97,35,99,16,07,97,57,32,16,26,26,79,33,27,98,66},
                    {88,36,68,87,57,62,20,72,03,46,33,67,46,55,12,32,63,93,53,69},
                    {04,42,16,73,38,25,39,11,24,94,72,18,08,46,29,32,40,62,76,36},
                    {20,69,36,41,72,30,23,88,34,62,99,69,82,67,59,85,74,04,36,16},
                    {20,73,35,29,78,31,90,01,74,31,49,71,48,86,81,16,23,57,05,54},
                    {01,70,54,71,83,51,54,69,16,92,33,48,61,43,52,01,89,19,67,48}
                  };

I get the following error

q11.c:8:10: error: invalid digit "8" in octal constant
q11.c:8:67: error: invalid digit "8" in octal constant
q11.c:15:49: error: invalid digit "8" in octal constant
q11.c:17:19: error: invalid digit "9" in octal constant
q11.c:18:58: error: invalid digit "9" in octal constant
q11.c:22:16: error: invalid digit "8" in octal constant
q11.c:24:46: error: invalid digit "8" in octal constant

mat

mat аватар

Offline

Зарегистрирован: 05.07.2012

Не…

Вот, для других параметров, этот же фрагмент, вопросов нет
{                                                   
   { 19, 2857,   12, 8571,   «0.35mm», » 999rpm» },
   { 16, 8750,   11, 2500,   «0.40mm», » 999rpm» },
   { 13, 5000,    9,    0,   «0.50mm», » 999rpm» },
   { 11, 2500,    7, 5000,   «0.60mm», » 950rpm» },
   {  9, 6429,    6, 4286,   «0.70mm», » 810rpm» },
   {  9,    0,    6,    0,   «0.75mm», » 760rpm» },
   {  8, 4375,    5, 6250,   «0.80mm», » 710rpm» },
   {  6, 7500,    4, 5000,   «1.00mm», » 560rpm» },
   {  5, 4000,    3, 6000,   «1.25mm», » 460rpm» },
   {  4, 5000,    3,    0,   «1.50mm», » 380rpm» },
   {  3, 8571,    2, 5714,   «1.75mm», » 320rpm» },
   {  3, 3750,    2, 2500,   «2.00mm», » 280rpm» },
   {  2, 7000,    1, 8000,   «2.50mm», » 220rpm» },
   {  2, 2500,    1, 5000,   «3.00mm», » 190rpm» },
   {  1, 6875,    1, 1250,   «4.00mm», » 140rpm» },
};

  1. Скетч для робота с ик приемником, ide ругается:invalid digit «8» in octal constant
    Понять в чем проблема смог, а как решить ее не могу понять все еще.
    Скетч:

    const long IR_COMMAND_FORWARD_CODES[] = { 377281, 7503, 2 };
    const long IR_COMMAND_BACKWARD_CODES[] = { 377282, 1583, 8 };
    const long IR_COMMAND_TURN_LEFT_CODES[] = { 377278, 0783, 4 };
    const long IR_COMMAND_TURN_RIGHT_CODES[] = { 377279, 7103, 6 };
    const long IR_COMMAND_FORWARD_LEFT_CODES[] = { 377278, 4863, 1 };
    const long IR_COMMAND_FORWARD_RIGHT_CODES[] = { 377280, 1183, 3 };
    const long IR_COMMAND_BACKWARD_LEFT_CODES[] = { 377280, 5263, 9 };
    const long IR_COMMAND_BACKWARD_RIGHT_CODES[] = { 377278, 8943, 7 };
    const long IR_COMMAND_STOP_CODES[] = { 377281, 3423, 5 };
    const long IR_COMMAND_VERY_SLOW_CODES[] = { 377280, 3223, 40 };
    const long IR_COMMAND_SLOW_CODES[] = {377281, 9543, 43 };
    const long IR_COMMAND_FAST_CODES[] = { 377278, 6903, 26 };
    const long IR_COMMAND_VERY_FAST_CODES[] = { 377279, 0473, 27 };
     
  2. А что вам непонятно? 0 перед числом говорит, что это число — в восьмеричной системе счисления, а там, как известно, нет цифры 8.

    0x перед числом — говорит, что это число в шестнадцатеричной системе счисления.

    Короче — уберите 0 спереди у чисел 0783 и 0473 — они там не нужны.

@sjoch

Hi.

I came across a strange errormessage and it might be a bug in the 1.0.5 version of the arduino software.

The part of the code that gets the error looks like this:
» if (i == 01) catchd01 = t;
if (i == 02) catchd02 = t;
if (i == 03) catchd03 = t;
if (i == 04) catchd04 = t;
if (i == 05) catchd05 = t;
if (i == 06) catchd06 = t;
if (i == 07) catchd07 = t;
if (i == 08) catchd08 = t;
if (i == 09) catchd09 = t;
«

And the compiler only complains on the last 2 lines.

error: invalid digit «8» in octal constant
error: invalid digit «9» in octal constant

So, whats wrong? it compiles good if all zeros are removed from the i == part.
But shouldnt it complain on all 9 lines if its the zero that is the problem.. why just 8 and 9?

@lestofante

because the compiler thinks you are using OCTAL number, and octal number
goes from 0 to 7.
Also, if this was a bug, was a COMPILER fault, you should had ask to
avr-gcc’s folks.

2013/6/30 sjoch notifications@github.com

Hi.

I came across a strange errormessage and it might be a bug in the 1.0.5
version of the arduino software.

The part of the code that gets the error looks like this:
» if (i == 01) catchd01 = t;
if (i == 02) catchd02 = t;
if (i == 03) catchd03 = t;
if (i == 04) catchd04 = t;
if (i == 05) catchd05 = t;
if (i == 06) catchd06 = t;
if (i == 07) catchd07 = t;
if (i == 08) catchd08 = t;
if (i == 09) catchd09 = t;
«

And the compiler only complains on the last 2 lines.

error: invalid digit «8» in octal constant
error: invalid digit «9» in octal constant

So, whats wrong? it compiles good if all zeros are removed from the i ==
part.
But shouldnt it complain on all 9 lines if its the zero that is the
problem.. why just 8 and 9?


Reply to this email directly or view it on GitHubhttps://github.com//issues/1490
.

@cmaglie

A constant number starting with «0» is interpreted as octal by the compiler, you must write «8» instead of «08».
BTW programming questions should be addressed to the forum.

http://forum.arduino.cc

C

@srknthcse

Error solved but i need clear explanation can anybody explain .thank you

@shaishu03

Error resuelto, pero necesito una explicación clara, ¿alguien puede explicarme? Gracias.

como lo solucionaste?

@arduino
arduino

locked as resolved and limited conversation to collaborators

Oct 21, 2022

int arr[20][20] = {
                    {08,02,22,97,38,15,00,40,00,75,04,05,07,78,52,12,50,77,91,08},
                    {49,49,99,40,17,81,18,57,60,87,17,40,98,43,69,48,04,56,62,00},
                    {81,49,31,73,55,79,14,29,93,71,40,67,53,88,30,03,49,13,36,65},
                    {52,70,95,23,04,60,11,42,69,24,68,56,01,32,56,71,37,02,36,91},
                    {22,31,16,71,51,67,63,89,41,92,36,54,22,40,40,28,66,33,13,80},
                    {24,47,32,60,99,03,45,02,44,75,33,53,78,36,84,20,35,17,12,50},
                    {32,98,81,28,64,23,67,10,26,38,40,67,59,54,70,66,18,38,64,70},
                    {67,26,20,68,02,62,12,20,95,63,94,39,63,08,40,91,66,49,94,21},
                    {24,55,58,05,66,73,99,26,97,17,78,78,96,83,14,88,34,89,63,72},
                    {21,36,23,09,75,00,76,44,20,45,35,14,00,61,33,97,34,31,33,95},
                    {78,17,53,28,22,75,31,67,15,94,03,80,04,62,16,14,09,53,56,92},
                    {16,39,05,42,96,35,31,47,55,58,88,24,00,17,54,24,36,29,85,57},
                    {86,56,00,48,35,71,89,07,05,44,44,37,44,60,21,58,51,54,17,58},
                    {19,80,81,68,05,94,47,69,28,73,92,13,86,52,17,77,04,89,55,40},
                    {04,52,08,83,97,35,99,16,07,97,57,32,16,26,26,79,33,27,98,66},
                    {88,36,68,87,57,62,20,72,03,46,33,67,46,55,12,32,63,93,53,69},
                    {04,42,16,73,38,25,39,11,24,94,72,18,08,46,29,32,40,62,76,36},
                    {20,69,36,41,72,30,23,88,34,62,99,69,82,67,59,85,74,04,36,16},
                    {20,73,35,29,78,31,90,01,74,31,49,71,48,86,81,16,23,57,05,54},
                    {01,70,54,71,83,51,54,69,16,92,33,48,61,43,52,01,89,19,67,48}
                  };

I get the following error

q11.c:8:10: error: invalid digit "8" in octal constant
q11.c:8:67: error: invalid digit "8" in octal constant
q11.c:15:49: error: invalid digit "8" in octal constant
q11.c:17:19: error: invalid digit "9" in octal constant
q11.c:18:58: error: invalid digit "9" in octal constant
q11.c:22:16: error: invalid digit "8" in octal constant
q11.c:24:46: error: invalid digit "8" in octal constant
int arr[20][20] = {
                    {08,02,22,97,38,15,00,40,00,75,04,05,07,78,52,12,50,77,91,08},
                    {49,49,99,40,17,81,18,57,60,87,17,40,98,43,69,48,04,56,62,00},
                    {81,49,31,73,55,79,14,29,93,71,40,67,53,88,30,03,49,13,36,65},
                    {52,70,95,23,04,60,11,42,69,24,68,56,01,32,56,71,37,02,36,91},
                    {22,31,16,71,51,67,63,89,41,92,36,54,22,40,40,28,66,33,13,80},
                    {24,47,32,60,99,03,45,02,44,75,33,53,78,36,84,20,35,17,12,50},
                    {32,98,81,28,64,23,67,10,26,38,40,67,59,54,70,66,18,38,64,70},
                    {67,26,20,68,02,62,12,20,95,63,94,39,63,08,40,91,66,49,94,21},
                    {24,55,58,05,66,73,99,26,97,17,78,78,96,83,14,88,34,89,63,72},
                    {21,36,23,09,75,00,76,44,20,45,35,14,00,61,33,97,34,31,33,95},
                    {78,17,53,28,22,75,31,67,15,94,03,80,04,62,16,14,09,53,56,92},
                    {16,39,05,42,96,35,31,47,55,58,88,24,00,17,54,24,36,29,85,57},
                    {86,56,00,48,35,71,89,07,05,44,44,37,44,60,21,58,51,54,17,58},
                    {19,80,81,68,05,94,47,69,28,73,92,13,86,52,17,77,04,89,55,40},
                    {04,52,08,83,97,35,99,16,07,97,57,32,16,26,26,79,33,27,98,66},
                    {88,36,68,87,57,62,20,72,03,46,33,67,46,55,12,32,63,93,53,69},
                    {04,42,16,73,38,25,39,11,24,94,72,18,08,46,29,32,40,62,76,36},
                    {20,69,36,41,72,30,23,88,34,62,99,69,82,67,59,85,74,04,36,16},
                    {20,73,35,29,78,31,90,01,74,31,49,71,48,86,81,16,23,57,05,54},
                    {01,70,54,71,83,51,54,69,16,92,33,48,61,43,52,01,89,19,67,48}
                  };

Я получаю следующую ошибку

q11.c:8:10: error: invalid digit "8" in octal constant
q11.c:8:67: error: invalid digit "8" in octal constant
q11.c:15:49: error: invalid digit "8" in octal constant
q11.c:17:19: error: invalid digit "9" in octal constant
q11.c:18:58: error: invalid digit "9" in octal constant
q11.c:22:16: error: invalid digit "8" in octal constant
q11.c:24:46: error: invalid digit "8" in octal constant

Понравилась статья? Поделить с друзьями:
  • Invalid data about errors перевод ошибка obd
  • Invalid data about errors ошибка авто
  • Invalid conversion from int to int ошибка
  • Invalid content was found starting with element ошибка
  • Invalid column name sql ошибка