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
Post a Comment