I am working on an embedded system (ARM Cortex M3) where I do not have access to any sort of “standard library”. In particular, I do not have access to malloc.
I have a function void doStuff(uint8_t *buffer) that accepts a pointer to a 512 bits buffer. I have tried doing the following:
uint8_t buffer[64] = {0};
doStuff((uint8_t *) &buffer));
but I’m not getting the expected results. Am I doing something wrong? Is there any alternative approach?
doStuff(buffer)shall be ok sincebufferis already anuint8_t*.Aside of this, you’re closing one bracket too much after
&bufferin your example.If
bufferis of variable size, you should pass the size intodoStufftoo, if it’s of constant size, I’d also pass the size just in case that you change the size one day.This being said, you should do it the following way: