#include <iostream>

void swap(char& a, char& b)
{
    char c = a;
    a = b;
    b = c;
}

// 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)
    {
        swap(a[i], b[j]);

        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";
}