Your message array is 10 characters long (0-9), but if you count "Hello, World!" (without quotes), it is 13 characters. This way you are rewriting memory that is not part of your array.
For reference, strcpy() , strcat() and most other C-line functions do not check the length of the array, they assume that you gave it enough space to work.
So you need to give your message array more space. But how much more? enough to fit "Hello world!" PLUS is another one for the null terminator character '\0' , which defines the end of a line. so you need to declare an array of 14 characters.
For a more detailed explanation of working with string and null character, I suggest this page . Although this is a C ++ page, it covers material that is common to C and C ++ (since C ++ is based on C)
Also, as Pearsonartphoto said, you can simply declare your array as
char message[] = "Hello, World!";
However, if this is for school or uni-assignment, be sure to be taught how to do it this way, because sometimes you can subtract marks for "quick progress." The idea behind these kinds of questions is to teach funementals, and HOW AND WHY some things work, they may not be the easiest or most effective way to do things (the type of glass punch you get still causes problems in the main systems today, because programmers forget to check sizes, etc.).
source share