Interchange

This is a discussion on Interchange within the C Programming forums, part of the General Programming Boards category; How to interchange two number without using temporary veraible? Juganoo...

  1. #1
    Registered User
    Join Date
    Nov 2002
    Posts
    38

    Interchange

    How to interchange two number without using temporary veraible?

    Juganoo

  2. #2
    Registered User
    Join Date
    Jul 2002
    Posts
    9
    int num1 = 10;
    int num2 = 11;

    num1 ^= num2;
    num2 ^= num1;
    num1 ^= num2;

    num1 = 11 num2 = 10

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. C program - inverse of a matrix
    By chaugh in forum C Programming
    Replies: 4
    Last Post: 01-18-2010, 11:00 PM
  2. interchange nodes in a linked list
    By Gustavo in forum C++ Programming
    Replies: 0
    Last Post: 10-26-2004, 08:14 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21