I am facing a compile time error here.
I tried to find solution to the error but cant reach a conclusion.
It says "expression cant be called as a function" when I am trying to return value using parenthesis in a user defined function.
My code is:
template <class t1>
t1 sum(t1 a, t1 b)
{
if (a != b)
{
return a + b;
}
else
{
return 3(a+b);
}
}
>Solution :
3(a+b) means nothing for a C++ compiler. If you are trying to multiply, use 3*(a+b). If 3 is a function, change its name, you can’t use a number as a function name.