    #include <iostream>
    #include <string.h>

    void foo(char* a, char* b){
             char* temp = new char[strlen(a)+1];

             strcpy(temp, a);
             std::cout << "temp = " << temp << " a = " << a << " b = " << b << std::endl;

             strcpy(a, b);
             std::cout << "temp = " << temp << " a = " << a << " b = " << b << std::endl;

             strcpy(b, temp); // this copies 6 bytes to b, which puts a 0 in the first byte of a.
             std::cout << "temp = " << temp << " a = " << a << " b = " << b << std::endl;

             delete[] temp;
    }

    int main() {
         char a[] = "First";
         char b[] = "Last";

         std::cout << "a size is " << sizeof(a) << std::endl;
         std::cout << "b size is " << sizeof(b) << std::endl;

         std::cout << "address of a[0] is " << (void*)&a[0] << std::endl;
         std::cout << "address of b[0] is " << (void*)&b[0] << std::endl;

         foo(a, b);

         std::cout << "A After: "<< a << "\n";
         std::cout << "B After: "<< b << "\n\n";
    }