I was wondering what properties double quotes have, especially in relation to initializing char pointers.
char *ptr="hello";
char array[6]={'h','e','l','l','o'};
cout<<ptr<<endl<<array<<endl;
The above code prints hello twice. I know that using double quotes denotes a string, or a char array with a null character at the end. Since ptr is looking for a memory address (char*) to be assigned to, I'm guessing that the "hello" resolves to the memory address of the 'h', despite the fact that you are also filling in char values for the rest of the array? If this is the case, does that mean that in the above code
char *ptr="hello";
the double quotes creates a string somewhere in memory and then ptr is assigned to the first element of that string, whereas
char array[6]={'h','e','l','l','o'};
creates an array somewhere in memory and then assigns values for each index based on the right hand side of the assignment operator?