What is output by the following program include using std co
What is output by the following program? #include using std:: cout; using std:: endl; void f1(): int main() {int x = 0; cout
Solution
Answer:
Initially, x = 0
During call to f1, x = 3
At the end, x = 0
in main method and f1() method, we have \"x\" integer variable as local variable. so if we change the value of x in either of that methods that will not give impact on others. So im main method, we declared x variable value as 0 and not modified so x value will always be 0 in main method.
in f1() method, we declared x variable value as 3. so x value will be 3 in f1() method.
