Results 1 to 2 of 2

Thread: Swap two numbers without using temp variable

  1. #1
    BellWard is offline Senior Member
    Join Date
    Dec 2009
    Posts
    236
    Rep Power
    3

    Default Swap two numbers without using temp variable

    Code:
    void swap_num(int *a,int *b)
    {
    *a = *a^*b; *b = *a^*b; *a = *a^*b;
    }

  2. #2
    CoxWatson is offline Senior Member
    Join Date
    Dec 2009
    Posts
    232
    Rep Power
    3

    Default

    Code:
    void main()
    {
    int a=10,b=20;
    a=a+b;
    b=a-b;
    a=a-b;
    }

Similar Threads

  1. Swap Any Two Numbers in JAVA
    By EvansMitchell in forum Programming
    Replies: 2
    Last Post: 06-17-2010, 01:55 PM
  2. Write a swap program without using temp variable.
    By WalkerCook in forum Programming
    Replies: 2
    Last Post: 04-27-2010, 01:53 PM
  3. How to Extract variable "file" and "path" of a variable
    By Halle Berry in forum Software Jargons
    Replies: 1
    Last Post: 10-20-2009, 10:55 AM
  4. Operating temp of phenom 550
    By Arnos Vale in forum Overclocking
    Replies: 1
    Last Post: 09-12-2009, 09:28 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