24. Inline Functions

Question.1

Two developers implement a MAX utility:

Developer A — C macro:

#define MAX(a, b) ((a) > (b) ? (a) : (b))

Developer B — C++ inline:

inline int max_val(int a, int b) {
   return (a > b) ? a : b;
}

A caller writes MAX(x++, y) and max_val(x++, y). What happens?

Need Help? Refer to the Quick Guide below

Select Answer