LogiQuest
Back to Templates
6

What will be the output of the program?

#include <iostream>
using namespace std;
template <typename T>
T add(T a, T b) { return a + b; }
int main() {
    cout << add(2, 3) << " " << add(1.5, 1.0) << endl;
    return 0;
}
Easy

Discussion (0)

  • No discussion yet. Ask a doubt or share a shortcut.

Log in to join the discussion.