I'm trying to use a callback function in C and I got into this piece of code:
memcpy(&(mem->response[mem->size]), data, realsize);
I understand everything except this part :
&(mem->response[mem->size]
I understand that we're trying to get the address of mem but what is []
in this context ?
If mem->response
is a pointer to an array of elements, then
mem->response[mem->size]
refers to the element at position mem->size
in that array and &
is used to get a pointer to that element.
You get the same result with mem->response + mem->size
if that makes it clearer:
memcpy(mem->response + mem->size, data, realsize);