CS 12 - Lab 3

In this lab you will write functions that simulate some of the C++ String handling functions. You should read section 5.12 starting on page 343 of the textbook before coming to lab. You might also want to do exercises 5.21 and 5.22 on pages 378-379.

The Functions

Write your own version of the following functions: Each of these functions is described on pages 346-347 of the textbook. Your function signatures, except for the names, must match those given in the book. For example, the signature for strcpy is:

   char *strcpy( char *s1, const char *s2 );

Therefore, the signature for your function will be:

   char *cs12strcpy( char *s1, const char *s2 );

You are not allowed to use any of the standard C++ functions in any of your functions.

Testing

To test your functions, write a main program to test them. The program should call each function at least twice. You will need to declare at least one character array for this (probably more). Make sure you declare an actual array and not a pointer. In other words, you should have a declaration such as:
   char string[ 80 ];

Grading

When you have finished the program, your TA will grade it. To receive full credit, your TA will check all of the following: