Results 1 to 3 of 3

Thread: Write a swap program without using temp variable.

  1. #1
    WalkerCook is offline Senior Member
    Join Date
    Dec 2009
    Posts
    253
    Rep Power
    3

    Default Write a swap program without using temp variable.

    Hi. I am new in programming world. Currently I am learning C programming language. C is mother language of all programming language. I practice different basic example of C but I am confused between writing a swap program without using temp variable. Anybody knows how to write a swap program without using temp variable. If you are having any examples then reply me. It can helpful to me.

  2. #2
    PerezMorris is offline Senior Member
    Join Date
    Dec 2009
    Posts
    250
    Rep Power
    3

    Default

    It is very easy program. Try out this code,

    Code:
    void swap(int X,int Y)
    {
        if(X == Y)
            return;
        X^=Y;
        Y^=X;
        X^=y;
    }

  3. #3
    HallMiller is offline Senior Member
    Join Date
    Dec 2009
    Posts
    251
    Rep Power
    3

    Default

    Code:
    Void()
    {
    Int a ,b ;
      a= a+b;
      b=a-b;
      a=a-b;
    }

Similar Threads

  1. Swap two numbers without using temp variable
    By BellWard in forum Programming
    Replies: 1
    Last Post: 07-09-2010, 02:16 PM
  2. Write program in LAN Voice Chat
    By MorganCooper in forum Programming
    Replies: 1
    Last Post: 04-03-2010, 01:16 PM
  3. write sequence data java program
    By Brownchris in forum Programming
    Replies: 1
    Last Post: 01-22-2010, 06:09 PM
  4. Write program on palindrome in java
    By MoralesMyers in forum Programming
    Replies: 2
    Last Post: 01-14-2010, 06:24 PM
  5. Where are the different c program variable allocated in the memory
    By Jarrius Arundel in forum Everything Else
    Replies: 5
    Last Post: 07-22-2009, 08:06 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
SEO by SubmitEdge

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48