Swapping of two numbers without arithmatic operator without temporary variable

#include<stdio.h>
void swap(int *a,int *b)
{
     *a^=*b^=*a^=*b;
 }
 int main()
 {
     int a=10,b=20;
     swap(&a,&b);
     printf("%d %d",a,b);
     getch();
     return(0);
 }

Comments

Popular posts from this blog

How to enable curl option in php

Simple Socket programming using TCP in java