Homework 4, String Functions.
Short Description:
Goals
When you finish this homework, you should have:- Demonstrate your ability to implement small functions
Formal Description
Create a small string/character library following the calling conventions. You may assume that all strings are properly formatted, ie they are terminated with a null character. Write a driver to test your library.Implement the following functions
- int My_isalpha(int c): returns true if the character is a letter
- int My_isspace(int c): returns true if the character is a newline, space or tab
- int My_isdigit(int c): returns true if the character is a digit 0-9
- int My_islower(int c): returns true if the character is a lower case letter
- int My_tolower(int c): if the character is an upper case letter, return the corresponding lower case letter, otherwise return the original letter.
- int My_strlen(char * s): returns the number of characters in s, not including the null terminator
- int My_strcmp(char * s1, char * s2): returns:
- 0 is s1 == s2
- negative is s1 < s2
- positive is s1 > s2
For these functions, true is 1 and false is 0.
These functions are modeled after the c library functions, unless specified otherwise, you should follow their behavior.
You should create a test driver to test all of your functions. This can be in C/C++.