1.

Predict the output?#include <iostream>using namespace std;template <typename T>void fun(const T&x){static int count = 0;cout << "x = " << x << " count = " << count << endl;++count;return;}int main(){fun<int> (1);cout << endl;fun<int>(1);cout << endl;fun<double>(1.1);cout << endl;return 0;}(A)x = 1 count = 0x = 1 count = 1x = 1.1 count = 0(B)x = 1 count = 0x = 1 count = 0x = 1.1 count = 0(C)x = 1 count = 0x = 1 count = 1x = 1.1 count = 2(D) Compiler Error

Answer»


Discussion

No Comment Found

Related InterviewSolutions