24. Inline Functions

Question.7

A developer uses both inline and constexpr for compile-time constants:

inline int baud_divisor(int clk, int baud) {
   return clk / baud;
}

constexpr int baud_divisor_ce(int clk, int baud) {
   return clk / baud;
}

int div1 = baud_divisor(16000000, 9600);
constexpr int div2 = baud_divisor_ce(16000000, 9600);

What is the key difference?

Need Help? Refer to the Quick Guide below

Select Answer