Hi
I am trying to combine two uint8_t values into a single uint16_t value, however no matter what I try I keep getting segmentation faults. Can someone explain to me what I am doing wrong – it would be greatly appreciated!
Thanks
Code:int combineHex(uint8_t x, uint8_t y) { uint16_t *temp = malloc(16); int value; if(temp != NULL) { memcpy(&temp, &x, 8 ); memcpy(&temp+8, &y,8); // do something with temp } // if free(temp); return value; } // combine