I am getting from a function a pointer to the (empty at the start) data of a block.
This pointer is:
char* data;
And my job is to insert different types of data in this block. I know only the data type (string/int/float) and their length in bytes.
For example, for an inserting integer, I want to give to each block a form like:
|block_num|age|weight|favorite_number|
So my main question is, how can I insert the number to the block and get them like? I would like smth like data[3] to get weight each time.
I have tried to use memset and memcpy, but there was no success.
Thanks for your time!