In Python, I'm used to things like
def send_command(command, modifier = None):
and then the modifier argument is optional, and the absence of the argument can be differentiated from an argument of 0. Is there similar functionality in C? I'm inexperienced with C, and Googling, but can't find a clear statement of how to use optional parameters in C. It seems you can assign them similarly, like this:
void send_command(uint8_t command, uint8_t modifier = 0) {
so the second argument is optional and defaults to 0 if not used? (Edit: No, this is invalid C anyway)
But can the function distinguish between send_command(SOMETHING)
and send_command(SOMETHING, 0)
? Ideally, the second parameter could be any uint8 value, including 0.
Maybe NULL is different from 0?
void send_command(uint8_t command, uint8_t modifier = NULL) {