diff --git a/Swap-without-third-variable/swap_2_numbers_using_pointers.cpp b/Swap-without-third-variable/swap_2_numbers_using_pointers.cpp new file mode 100644 index 0000000..6882bba --- /dev/null +++ b/Swap-without-third-variable/swap_2_numbers_using_pointers.cpp @@ -0,0 +1,18 @@ +#include +using namespace std ; + +void swap_numbers(int* a,int* b) +{ + *a = *a + *b ; + *b = *a - *b ; + *a = *a - *b ; + +} + +int main() +{ + int *x = 10, *y = 20 ; + swap_numbers(x , y ) ; + cout<<*x<