In case of an Inline function, the compiler copies the whole function from where it has been called. If I follow that instruction the o/p of the programme should be "2010" but it shows the o/p "2020". Why is it so? Did I misunderstand the definition of Inline function? The code goes below:
#include<iostream> #include<cstdio> using namespace std; inline void f(int x) { printf("%d",x); x=10; } int main() { int x=20; f(x); printf("%d\n",x); return 0; }
f(int)and change the copy.