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
Post a Comment