The problem is with your string definition, not with the use of strupr, as some of the comments above already stress it. Your str
pointer really points to read-only memory, hence the crash.
Look at this question that quotes c-faq.com, or directly in the C standard: "The contents of the arrays are modifiable. On the other hand, the declaration
char *p = "abc";
defines p with type “pointer to char” and initializes it to point to an object with type “array of char” with length 4 whose elements are initialized with a character string literal. If an attempt is made to use p to modify the contents of the array, the behavior is undefined."
To make that code work simply define an non-const array:
char str[]="these";