cancel
Showing results for 
Search instead for 
Did you mean: 

I am not able to copy a uint8_t to uint8_t*

LimoGr
Associate II

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!

1 ACCEPTED SOLUTION

Accepted Solutions

memcpy(&Buffer[head],Rxdata,1);

​or

Buffer[head] = *Rxdata;

o​r

Buffer[head] = Rxdata[0];

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

View solution in original post

2 REPLIES 2

memcpy(&Buffer[head],Rxdata,1);

​or

Buffer[head] = *Rxdata;

o​r

Buffer[head] = Rxdata[0];

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

Thank you!