+ 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; }

25th Sep 2017, 4:40 PM
Shivani Goyal
3 Answers
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.
4th Jan 2018, 1:31 PM
tarun
tarun - avatar