Home > C programs related to integers

In the following program fragment, s, b are two integers

b = s + b;

s = b – s;

b = b – s;

What does it intend to do ?

 

A)  Transfer the contents of s to b
B)  Transfer the contents of b to s
C)  Exchange (swap) the contents of s and b
D)  Negate the contents of s and b
Answer: Exchange (swap) the contents of s and b

    Leave a Comment

    Your email address will not be published. Required fields are marked *