I was reading a c++ code and i came across this problem and i don't know what it mean:
uint8 (*const flag_search)[SEARCH_RANGE]=
(uint8 (*)[SEARCH_RANGE])&_flag_search[MAX_MOTION][MAX_MOTION];
can someone explain it for me ?
I was reading a c++ code and i came across this problem and i don't know what it mean:
uint8 (*const flag_search)[SEARCH_RANGE]=
(uint8 (*)[SEARCH_RANGE])&_flag_search[MAX_MOTION][MAX_MOTION];
can someone explain it for me ?
uint8 (*const flag_search)[SEARCH_RANGE]
flag_search
is a const pointer pointing to an array, which contains SEARCH_RANGE
elements with type uint8
.
(uint8 (*)[SEARCH_RANGE])&_flag_search[MAX_MOTION][MAX_MOTION]
&_flag_search[MAX_MOTION][MAX_MOTION]
will take the address of _flag_search[MAX_MOTION][MAX_MOTION]
, and cast it to uint8 (*)[SEARCH_RANGE]
, which is a non-const pointer pointing to an array, which contains SEARCH_RANGE
elements with type uint8
.