Q. What will be the output of the following C++ code?

Code:
#include <iostream>
using namespace std;
void fun(int x, int y){
    x = 20;
    y = 10;
}
int main() {

    int x = 10;
    fun (x, x);
    cout << x;
    
    return 0;
}
  • (A) 10
  • (B) 20
  • (C) 30
  • (D) Compile time error
πŸ’¬ Discuss
βœ… Correct Answer: (A) 10

You must be Logged in to update hint/solution

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
218
Total Visits
πŸ“½οΈ
4 y ago
Published
πŸŽ–οΈ
Rajeev Malhotra
Publisher
πŸ“ˆ
99%
Success Rate