Register
 

Advertisement in just 5$

Engineering, Computer, Scholarship and SEO Support Forum



Author Topic: The purpose of following program fragment b = s + b; [Programming with C]  (Read 449 times)

Offline mechanic

  • Engineer
  • Hero Engineer
  • *****
  • Posts: 3062
    • View Profile
    • Engineering Forum
Advertisement
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.


Engineering, Computer, Scholarship and SEO Support Forum