Write a function to convert a string to upper case (without using toupper). Your function should take a
char as a parameter and return nothing (modifying the existing string rather than returning a new one).
Note: A single char is actually an 8-bit integer, where each letter, digit, and punctuation symbol is represented by a fixed integer "ASCII" value. Uppercase and lowercase letters have sequential values; e.g. 'B' == 'A' + 1 and 'b' == 'a' + 1. Use this information to work out how to convert a single character to uppercase. You can find the values for all characters by looking up an ASCII table. However, you don't actually need to know them. You can simply use 'A', 'B', etc.
Try implementing this function in several different ways:
(a) Using the
strlen() function and retrieving each character in turn with the array indexing notation (
(b) Without using
strlen(). (Hint: how do you know where a string ends?)
(c) Without using the array indexing notation. (Hint: modify the string pointer itself.)
Use this function in your program so that the first command-line parameter is the case- insensitive (i.e. so that the user can enter "sum", "SUM", "Sum", "suM", etc.).