well last time I checked an inline function is a function whose body is substituted directly in every point in the program where the function is called. So when I do this :
#include <iostream> inline void increment(int n) { n = n + 1; }` int main() { int n = 0; increment(n); std::cout << "Result " << n; } I should have : Result 1. Instead, I get 0.
So how does an inline function work ?
n, not the one inmain. Inline functions behave exactly the same as non-inline ones.