hello guys.. i need to write a program in C, to exchange 2 variables without using any arithmetic operators.. can any one help me please.. this is kinda urgent!!!
hello guys.. i need to write a program in C, to exchange 2 variables without using any arithmetic operators.. can any one help me please.. this is kinda urgent!!!
What have you tried so far?
You may find some use in reading Lesson 6: Pointers.
thnx 4 d help! i did it!
> to exchange 2 variables without using any arithmetic operators
Weird - the usual trick to this question is to swap things without using a temporary variable.
Since you wouldn't normally use arithmetic operators to swap things anyway, perhaps all you need is
temp = a ; a = b ; b = temp;
See - no arithmetic there
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.