Why is result 1 in statement add(n) and why it is 101 in n=add(n).I have also noticed that if I writeCode:#include <iostream> using namespace std; int add (int i) { i=i+100; return i; } int main() { int n=1; add(n); cout << "n:" << n << endl; n=add(n); cout << n << endl; system("pause"); return 0; }
insteadCode:cout << "n:" << add(n) << endl;
result is 101?Code:add(n);
In which cases it will return 1 and why?