+ 1
why do not it' output is 100?
#include <iostream> using namespace std; void myFunc(int x) { x = 100; } int main() { int var = 20; myFunc(var); cout << var; }
1 Answer
0
In a main method you define a var variable with the value 20.
and call the myfunc with pass the variable var and initialize the variable with 100 not printed.
and print the var which value is 20 not 100.