What will be the output of following code :
#include <iostream> using namespace std; #define x 5/2.0 #define y 3/2.0 // Function 1 int add(float a, float b){ cout << "Function 1";
return a + b;
} // Function 2 int add(double a, double b){ cout << "Function 2";
return a + b;
} // Function 3 int add(int a, int b){ cout << "Function 3";
return a + b;
} // Driver Function int main() { cout << add(x, y) << endl;
return 0;
} |
(A) Function 2 4
(B) Function 3 4
(C) Function 1 4
(D) None of these
Answer: (A)
Explanation:
Quiz of this Question
Please comment below if you find anything wrong in the above post
Article Tags :
Recommended Articles