Hi,
I was looking at this old forum thread:
http://cboard.cprogramming.com/archi...p/t-63079.html
and was a bit confused as to what size_t (size_t serialize) is - is it a standard typedef in C (as I have seen it mentioned elsewhere here, or a placeholder for me to place my own type in?
edit
just found it - its a replacement for int in string and memory copy functions
Just trying to understand this code, would someone be able to clarify some lines I don't understand please..
Code:
struct dumb by[sizeof member] =
defining a struct of type dumb with name by - what does the sizeof member do, dynamically size the array?
Code:
memcpy(&dst[i], &object->broiled, sizeof object->broiled);
i += sizeof object->broiled;
I'm a bit confused as to what the function of i is here - I can see that the memcpy transfers the contents of each member to consecutive array indexes
Code:
void showbytes(const void *object, size_t size)
{
const unsigned char *byte;
for ( byte = object; size--; ++byte )
whats the purpose of size here, and why is it decremented?
--dave