What programming errors is this page highlighting?
c
Solution
The first one seems simple; malloc could return null, and strcpy could try to copy data to memory address 0. Or s could be a pointer to a string (rather than an array), and malloc would only allocate enough space for a pointer, and would try and copy a string into it. (I think).
Simple enough, right? You missed the most obvious thing wrong with this: you are not allocating enough space. `strcpy()` copies the string plus the terminating null byte, so the destination buffer must be size at least 1 bigger than the length of the string.
Problem
http://dspace.dial.pipex.com/town/green/gfd34/art/bloopers.html The first one seems simple; ``` return strcpy(malloc(strlen(s)), s); ``` `malloc` could return `null`, and `strcpy` could try to copy data to memory address 0. Or s could be a pointer to a string (rather than an array), and `malloc` would only allocate enough space for a pointer, and would try and copy a string into it. (I think). What about the second one though? What a shame that he didn't cast ch to unsigned char when he wrote ch = toupper(ch); Why should you cast `ch` to `unsigned char` if you write `ch = toUpper(ch);`?