Interview Question

Hardware Engineer Interview Madison, WI

How will you swap the contents in two variables in C?

Answer

Interview Answer

1 Answer

1

first declare one temporary variable(temp) and copy the contents of the one of the variable(A) to the temp. Then copy the contents of the other variable(B) to A.
Finally copy the contents of temp to B.

Interview Candidate on Oct 21, 2010

Add Answers or Comments

To comment on this Question, Sign In with Facebook or Sign Up