Tag Archives: bitwise

Different methods of swapping 2 numbers

#include<stdio.h> void swap(int *,int *); int main() { int temp; int *t; int a=100,b=200; //Using 3 variables //1.1 temp = a; a = b; b = temp; printf(“%d %d\n”,a,b); //1.2 swap(&a,&b); printf(“%d %d\n”,a,b); //Using 2 variables //2.1 a += b; … Continue reading

Posted in Data Structures with C | Tagged , , , , | Leave a comment