The code states:
void (* log_msg)(char *msg)
=printf;
void change_and_log(int *buffer, int offset, int value){
buffer[offset] = value;
log_msg("changed");
}
I'm most concerned with the first part:
Firstly, what does the signature void (* log_msg)(char *msg)
mean? Is this code simply mapping the function log_msg
to printf
? In that case, why is the function name (* log_msg)
and not simply log_msg
?