Search code examples
cfunctioninline

inline function in c


Can inline function be declared in .h and defined once in .c?


Solution

  • inline function definitions need to be visible wherever the function is invoked. You can define the function in a .c file if you only want to use it within that .c file, otherwise you need to define it in a .h file so that the definition can be #included wherever it is needed.