Originally Posted by
Edelweiss
If I do the malloc inside the fill buffer function, how do I free it outside the function?
Since you don't need malloc there, just pass a char*.
Originally Posted by
Edelweiss
oh the fillupbuffer function basically looks like this
It seems you renamed it
You probably want to pass the address of a, e.g.,
Code:
void fillupbuffer(char *buffer)
{
uint16_t a = 1234;
memcpy(buffer, &a, sizeof(a));
}
Of course, now fillupbuffer(&buffer) should be fillupbuffer(buffer). Incidentally, are you trying to fill the buffer with "1234" instead?