how to translate-> static uint8_t * song = (uint8_t*)"C2.C2,D4,C4,F4,E8,";

Hi all,
Can kindly help to translate

static uint8_t * song = (uint8_t*)"C2.C2,D4,C4,F4,E8,";

my understanding as below, pls correct me if i am wrong:

static -> storage class type static

uint8_t -> unsigned integer data type which has only 8 bits

* song -> is it pointer ?

(unit8_t*) -> ?

"C2.C2,D4,C4,F4,E8," -> ?

thanks you all in advance.
Last edited on
The string literal has type const char[19]. In the expression it is converted to the pointer to the first its element that is to const char * When this pointer is casted to uint8_t ( (uint8_t) ) though if to use a casting then it would be more correctly to write ( const uint8_t ). So the correct statement should look like

static const uint8_t * song = (const uint8_t*)"C2.C2,D4,C4,F4,E8,";
Last edited on
Topic archived. No new replies allowed.