HOW CAN WE MAKE A FUNCTION FOR SWAMPING USING TEMPLATE IN C PLUS PLUS?

Kate Smith

Total Post:24

Points:168
Posted by  Kate Smith
 935  View(s)
Ratings:
Rate this:
Hi,

How can we make a function for swamping using template in c++? 

Thanks in advance for any recommendations or solutions.
  1. AVADHESH PATEL

    Post:604

    Points:4228
    Re: how can we make a function for swamping using template in C plus plus?

    Hi Kate,


    try this:

    template <class X)
    void swapargs(X &a,X &b)
    {
    X temp;
    temp=a;
    a=b;
    b=temp;

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!