Which lines contain errors?
#include <iostream>
using namespace std;

template <class X, class Y> void f(X,Y) {
    cout<<"Ok"<<endl;
}
void main(void) { 
    f(1,1);                 //1
    f<int ,int>('c', 1);    //2
    f<string>("str",1.1);   //3
}
Explanation
For lines // 1 and // 3, the data type in the function is automatically determined by the compiler based on the types of function parameters. For line // 2, char is converted to int

Follow CodeGalaxy

Mobile Beta

Get it on Google Play
Send Feedback
Cosmo
Sign Up Now
or Subscribe for future quizzes