#include <iostream>

// assumes both a and b point to enough memory to hold the 
// longest of the strings.
void swap_strings(char a[], char b[])
{
    unsigned i = 0, j = 0;
    unsigned eos_count = 0; // end-of-string count.

    while (eos_count < 2)
    {
        char c = a[i] ;
        a[i] = b[j] ;
        b[j] = c ;

        if (!a[i])
            ++eos_count;

        if (!b[j])
            ++eos_count;

        ++i, ++j;
    }
}

int main()
{
    char one[32] = "one";
    char three[32] = "three";

    std::cout << "one: \"" << one << "\"\n";
    std::cout << "three: \"" << three << "\"\n";

    swap_strings(one, three);

    std::cout << "one: \"" << one << "\"\n";
    std::cout << "three: \"" << three << "\"\n";
}