Interview Question

What is inline function?

inline does not guarantee expansion; it participates in C function-definition and linkage rules.

💡 Concept ✅ Quick Revision ⚙ C

Answer

The inline function specifier suggests special linkage rules and permits, but does not require, inline substitution. • The implementation decides whether to replace a call with the function body. • Inlining does not change the observable behavior required by the standard. • The exact rules differ for inline, extern inline, and static inline definitions.

💡 C Example

static inline int maximum(int left, int right) { return left > right ? left : right; }

⚡ Quick Revision

inline does not guarantee expansion; it participates in C function-definition and linkage rules.