This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Pointers.....UGH!!!!
I have the following in an h file:
char *pMetaData[] = {"DC_", "ST_", "SP_", "SW_"}; typedef struct { char *pMeta; uint16_t *pData; }toPC;
In main I have the following:
#pragma PERSISTENT(dc_offset) #pragma location = 0x1800 uint16_t dc_offset = DC_OFFSET_DAC; toPC *uartTx; int main(void) { uartTx->pData = &dc_offset; uartTx->pMeta = &pMetaData;
Two issues:
#515-D a value of type "char *(*)[4]" cannot be assigned to an entity of type "char *"
First is warning (I have tried a ton of things at this end and seems it only removes the warning if I set in main uartTx->pMeta = &pMetaData[0][0]).....Why is this in my mind it's simple I need a pointer to point to the 1st array....seems like &pMetaData should work????
Second issue:
If I get rid of the warning and I build the code and look at expressions you can see the assignments are pointing to completely different spaces than the variables I want (see below)....What is a person supposed to do here?? Seems no matter how much I do with pointers they ALWAYS stump me....
Resolved.....
Had to define a variable as well as pointer toPC:
toPC uartTx, *p_uartTx = &uartTx;
**Attention** This is a public forum