2023-03-22 03:25 AM
Hi! I don't know if this is the right place to ask this question and it may seem stupid but I am a beginner and have been trying to resolve this for one day.
I am receiving one byte of data through UART to Rxdata, I want to copy this one byte to a 10 bytes buffer. I used this function:
uint8_t Rxdata[1];
uint8_t* Buffer[10];
int head=0;
memcpy(Buffer[head],Rxdata,1);
head++;
If someone can help me with this I would be grateful. And if you have also good explanation of variable types (It is still not very clear in my head)
Thank you!
Solved! Go to Solution.
2023-03-22 03:43 AM
memcpy(&Buffer[head],Rxdata,1);
or
Buffer[head] = *Rxdata;
or
Buffer[head] = Rxdata[0];
2023-03-22 03:43 AM
memcpy(&Buffer[head],Rxdata,1);
or
Buffer[head] = *Rxdata;
or
Buffer[head] = Rxdata[0];
2023-03-22 04:03 AM
Thank you!