There is no difference with the literals themselves. The difference is with the actual variable you're telling the compiler that you want, str. That variable has different types, and thus the different types have different representations.
In the first case, you say "I want str to be a character pointer, initialized to somewhere (I don't care where) where the string "hello" is to be found".
In the second case you say "I want str to be an array of 10 characters, where the five first are initialized with the string "name".
These are clearly completely different things. It's highly likely that in the program for the second case the string literal "name" still exists in some read-only location but is copied into str when the program starts.
char *strandchar str[]and how both are stored in memorychar str2[] = "hello";simply means an array with string"hello"will be created.