199. Lambdas and Callback Management

Question.2

A captureless lambda is passed to a C-style callback API:

void register_irq(void (*cb)(int));  // C API

register_irq([](int code) {
   log_error(code);
});

Why does this work even though the API expects a raw function pointer?

Need Help? Refer to the Quick Guide below

Select Answer