The purpose of following program fragment b = s + b; [Programming with C]

  • 0 replies
  • 544 views
*

Online mechanic

  • *****
  • 3127
    • View Profile
    • Engineering Forum
The purpose of following program fragment

b = s + b;
s = b - s;
b = b - s;

Where s, b are two integers is to

Options are:

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

Correct answer is:

C. exchange (swap) the contents of s and b.