c - Pass double to a function expecting uint8_t* -


suppose have function takes double pointer argument , want modify value:

void fun(uint8_t *arg1) {     *arg1 = 2; }  int main(void) {     double a;     fun((uint8_t*)&a); // not work      return 0; } 

is possible?

what specifying undefined behaviour: can't cast pointer different type.

your best bet create uint8_t in main, pass pointer function fun, assign modified value double.


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -