What will be the output of following function if we call this-00765
This subjective question is related to the book/course vu cs504 Software Engineering - I. It can also be found in vu cs504 Mid Term Solved Past Paper No. 2.
Question 1: What will be the output of following function if we call this function by passing int 5?
template T reciprocal(T x) {return (1/x); }
template T reciprocal(T x) {return (1/x); }
Answer:
The output will zero as 1/5 and its .05 but conversion to int make it zero. Above is prototype of template class so assume passing an int and returning an int