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

java - How to specify maven bin in eclipse maven plugin? -

single sign on - Logging into Plone site with credentials passed through HTTP -

php - Why does AJAX not process login form? -