I want to copy an array into a second array at the position index.
What I did is:
uint8_t* _data = (uint8_t *)malloc(8U*1024);
uint32_t index= 4U;
uint8_t name[] ="TEST";
memcpy(&data[index], name, sizeof(uint32_t));
index+= 4U;
When I print data using:
for (int j =0; j<index; j++)
{
printf("%c \n",data[j]);
}
it is empty. I want to find at data[3] "TEST"
data(or_data? Please edit and clarify) contain undetermined values, so what output do you expect?sizeof(uint32_t)doesn't make much sense here, you should rather usesizeof(name).for (int j =0; j<offset; j++)->for (int j = offset; j< offset + 4; j++)