Well think about how will the compiler know what is the return type of the function when you call it as f( 3 )?
When you have written f<float>(3); you have explicitly specified that the template type parameter T corresponds to float. So the compiler will be happy.:)
Last edited on
I see now.
Thank u for ur help :)