Engineering, Computer, Scholarship and SEO Support Forum

EDUCATION => Computer and I.T => Programming with C [MCQ] => Topic started by: mechanic on February 25, 2017, 08:52:38 AM

Title: The purpose of following program fragment b = s + b; [Programming with C]
Post by: mechanic on February 25, 2017, 08:52:38 AM
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.