Thread: Interchange

  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, 07:14 PM