DIGIT-ARC read-only archive · snapshot: July 23, 2026

i gt problem in C Program again !!! HELP ME PLS !!!

17 posts · originally from https://geek.digit.in/community/threads/i-gt-problem-in-c-program-again-help-me-pls.92632/

I
ImBeck Original post #1
Jul 10, 2008 at 1:21 AM
How do you exchange or swap TWO (2) variables A and B with using a
third or temporary variable?

C program (Attach TWO (2) sample output for each program)

JUST SHOW ME 2 EXAMPLE OF C PROGRAM
gary4gar
Jul 10, 2008 at 1:24 AM
simple, here is a algo & please code the program yourself:p
let a=5
b=6
a=a+b
b=a-b
a=a-b
now a=6 and b=5
RCuber
RCuber #3
Jul 10, 2008 at 1:29 AM
another homework.. :rolleyes:
goobimama
Jul 10, 2008 at 1:45 AM
Why're you making a new thread for this? Post it in that thread you've already created about C...
QwertyManiac
Jul 10, 2008 at 6:19 AM
You are seriously asking how to swap with a temporary variable and not without?
Faun
Faun #6
Jul 10, 2008 at 8:38 AM
^^guess not
Pathik
Pathik #7
Jul 10, 2008 at 5:33 PM
In that case,
x=a;
a=b;
b=x;

PS: Makes me feel like a genius coder. :p
Kl@w-24
Kl@w-24 #9
Jul 10, 2008 at 6:21 PM
Maybe we should create a separate thread: "Post all your homework questions here" :lol: :D
C
coolbuddy #11
Jul 10, 2008 at 7:28 PM
a=a^b;
b=a^b;
a=a^b;
QwertyManiac
Jul 10, 2008 at 8:04 PM
How's addition and subtraction less expensive than an XOR? You've learned your computer architecture properly, haven't you Garbage? :p It would result in more gate delays than a simple xor.
Garbage
Garbage #14
Jul 10, 2008 at 8:08 PM
How's addition and subtraction less expensive than an XOR? You've learned your computer architecture properly, haven't you Garbage? :p It would result in more gate delays than a simple xor.
I thought he meant "raise to" :|

thought it's algorithm than statements...
gary4gar
gary4gar #15
Jul 10, 2008 at 10:55 PM
How's addition and subtraction less expensive than an XOR? You've learned your computer architecture properly, haven't you Garbage? :p It would result in more gate delays than a simple xor.
yep, Bitwise operations are fastest.:)
but this things are never taught in our education system
what we learn is using a two and a half decade old program called "TC" :(
cooldip10
cooldip10 #16
Jul 11, 2008 at 6:55 AM
a thread named "HOMEWORK HELP" must started :D

This will save space + other's problems can be reviewed without having to use the search engine
jal_desai
jal_desai #17
Jul 23, 2008 at 9:22 PM
dont u think the question deserved no more than 2 posts.. (this applies to me also for posting this useless post) :D