evading
evading

Reputation: 3090

How to allocate tempoarary small memory segments in C

I'm trying to use a circular buffer like the one mentioned in this post: https://stackoverflow.com/a/827749

When I need to push and pop things to the buffer I find myself doing something like this all the time:

int data;
int *data_ptr = &data;
cb_pop(spi_buffer, data_ptr);

Is this the best (probably not) way to do this? How would you do it?

Thanks

Upvotes: 0

Views: 184

Answers (1)

MByD
MByD

Reputation: 137312

Why won't you just do:

int data;
cb_pop(spi_buffer, &data);

the creation of another pointer variable is redundant.

Upvotes: 3

Related Questions