hex[index] = (char)(i + 48);
takes the index i in the range 0 to 9 and converts it into the character '0' to '9', resp. The character code of '0' is 48.
hex[index] = (char)((i-10) + 65);
does the similar thing with the index i in the range 10 to 15 and converts it into the character 'A' to 'F', resp. The character code of 'A' is 65.
This conversion is only true for ASCII and derived character coding which you are using most probably.
<rant> Some people just have learned to stumble in a language and the first thing they do is to set up a web page titling it "C programming for beginners." But due to their really limited knowledge of the language they spread wrong and half-baked statements... Unfortunately you fell into one of these traps. Well, it could bring you to learn more and better because you find the gaps and errors on that web sites. Good luck! </rant>
Both lines should have been written like this, not taking into account other issues with the linked program:
hex[index] = i + '0';
and
hex[index] = i - 10 + 'A';
Or, even better:
char hex[] = "0123456789ABCDEF";
hexis an array of characters - hence you don't need to typecast with(char)