Two basic C++ questions about string literals and dynamic allocation
<p>Are these two equivalent?</p>

<p>char * aString = "This is a string.";</p>

<p>char aString[] = "This is a string.";</p>

<p>From my understanding, C++ stores strings by their addresses, so the pointer is getting a valid address. I assume the strings are also stored as type char? But how does it know how much memory to allocate for the string? Normally, char arrays need their array size preset. I believe the [] type arrays are counted by the compiler before compilation. Is this what happens for the string literal pointer as well?</p>

<p>On to my second question, what is the difference between these two:</p>

<p>int someNumber;</p>

<p>int * someNumber = new int;</p>

<p>The second is supposed to be dynamic allocation. If I understand the concept right, it allocates the memory as soon as it reads the declaration. But what happens in the standard declaration? Basically, I need to understand how dynamic allocation is advantageous over standard declarations.</p>
