The swap() function can interchange the content of two string variables without using any third variable. The swap function is built-in many programming languages that does not return anything, it only swaps the contents of the two variables. While swapping the content of two strings, if we specify the values to variables or excel user-defined values, it will swap the contents of variables but the value of variables will endure the same at the original place. Therefore, it would be more satisfying that we give the contents to the variables by reference, it will swap the contents of variables at the real place.