0
y the ans is not 120?
#include <iostream> using namespace std; int myFunc(int x) { int m = x+100; return m; } int main() { int var = 20; myFunc(var); cout << var<<endl; }
1 Resposta
+ 4
cuz you are printing var value that is 20..
calling of a function was at the wrong place
try this now
#include <iostream>
using namespace std;
int myFunc(int x) {
x = x+100;
return x;
}
int main() {
int var = 20;
cout << myFunc(var)<<endl;
}