What is the standard procedure to allocate memory on the stack. I am currently creating a temporary array
const uint8_t _buf[buf_size];
const uint8_t* buf = _buf;
I never use _buf
again. I feel dirty. Is there a better way?
Edit:
The reason I need the pointer is because I am passing it to a function which increments the pointer. I dont believe this will work well with passing an array. Here are more details:
const uint8_t _buf[buf_size];
const uint8_t* buf = _buf;
buf_size = fread((void *)buf, 1, buf_size, file);
// f increments the pointer in buf
f(&buf, &buf_size);