3

I have an included file in an Arduino program. MCU is ESP32.

included file is:

const char bitmap_1587[] PROGMEM = {248,254,254,230,241,231,247,199};
const char bitmap_1604[] PROGMEM = {249,254,254,254,0,191};
const char bitmap_1575[] PROGMEM = {7};
const char* char_addr[] = {&bitmap_1587,&bitmap_1604,&bitmap_1575};

When i compile the code, this error is returned:

cannot convert 'const char (*)[6] to 'char*' in initialization

cannot convert 'const char (*)[6]' to 'char*' in initialization

cannot convert 'const char (*)[1]' to 'char*' in initialization

Please help me. How can i store char array address in an other array.

1
  • 3
    Undefined behaviour in case of signed char overflow. Commented Jul 16, 2021 at 19:31

1 Answer 1

6

This would be correct:

const unsigned char bitmap_1587[] PROGMEM = { 248,254,254,230,241,231,247,199 };
const unsigned char bitmap_1604[] PROGMEM = { 249,254,254,254,0,191 };
const unsigned char bitmap_1575[] PROGMEM = { 7 };
const unsigned char* char_addr[] = { bitmap_1587,bitmap_1604,bitmap_1575,bitmap_1605,bitmap_32,bitmap_97,bitmap_98,bitmap_99,bitmap_1777,bitmap_1778,bitmap_1779 };
  • you need unsigned char because you have values > 127
  • you need to remove the &s, bitmap_1587 etc. are already addresses
  • you need const char* char_addr[] because you have const for the bitmap_... arrays.
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.