Template<typename T> isn't working

When I try to use templates on functions I keep getting “error: expected constructor, destructor, or type conversion before ‘(’ token”. Does anyone know why this is happening? My code looks like this:

template

T mathlol(T num1, T num2) {

return num1 * num2;

}

mathlol(7.2, 10);

int main() {

}

Yes I did put template < typename T > but when I put it in properly in the typing space here it disappears for some reason

Hi!

Please see this article for tips on how to properly format your code in a post: [How to] Format code in posts

Assuming it’s just the <typename T> that’s missing, your function call should be inside your main() method. Then it’ll run with no problem.