chapter 12 exercise 12-2: implement the c_str, data and copy functions