C FunctionsLesson 29Free preview
C Inline Functions
This lesson is part of C · All levels
Summary
Inline function is a function that is required to insert the code directly into the calling point instead of performing the usual function calling. In C this is expressed by the static inline keyword on the definition of a function. The goal is to reduce the overhead of function naming on the small functions that are often used. But the decision to insert is entirely in the compiler, so the inline word is more of an advice than an absolute command.
Key points
- Inline is written with static inline on the definition of a small function
- Compiler may refuse inline request if deemed unfavorable
- Suitable for small functions often called repeat
- Its main benefit is to reduce the overhead load of function calling
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.