I need a reference pointer that has different data types; for example, 3 ints and one pointer to array.
I'm trying this:
const unsigned char PIC[] = {0xd0, 0xe0, 0xf0, 0x10, 0x20}; int main(){ void *p; p = malloc(3*sizeof(unsigned char)+(1*sizeof(unsigned char*))); *(unsigned char *)(p+0) = 990; *(unsigned char *)(p+1) = 88; *(unsigned char *)(p+2) = 77; *(unsigned char *)(p+3) = &PIC; // I know this isn't working ! printf("%d\n",*(unsigned char *)(p+0)); printf("%d\n",*(unsigned char *)(p+1)); printf("%d\n",*(unsigned char *)(p+2)); printf("%d\n",*(unsigned char *)(p+3)); // also i know this is not the right way to call array elements ! }
I think it worked for the uint8_t part but not with the array.
Any suggestions ?