C - discard pointer parameter -


i'm not sure how phrase question i'll give example of i'm looking do.

i have function gets next byte fifo.

void fifoget(uint8_t * byte) {    *byte = somefunction(); } 

i'm making function flush fifo

void fifoflush(void) {     uint8_t i;     uint8_t discardbyte;      (i=0; i<fifolength; i++) {         fifoget(&discardbyte);     }  } 

what i'm wondering, since don't need discardbyte, can around allocating memory , pass void pointer fifoget()?

something like

void fifoflush(void) {     uint8_t i;      (i=0; i<fifolength; i++) {         fifoget(&void);     }  } 

no, void approach cause behaviour of program undefined you'll dereferencing pointer unknown memory.

your using discardbyte best thing do.


Comments

Popular posts from this blog

javascript - How to synchronize the Three.js and HTML/SVG coordinate systems (especially w.r.t. the y-axis)? -

javascript - How do I find how many occurences are there of a highlighted string, and which occurence is it? -

java - Reading data from multiple zip files and combining them to one -