Pointer to const char vs char array vs std::string
<p>Here I've two lines of code</p>

<pre><code>const char * s1 = "test";
char s2 [] = "test";
</code></pre>

<p>Both lines of code have the same behavior, so I cannot see any difference whether I should prefer <code>s1</code> over <code>s2</code> or vice-versa.  In addition to s1 and s2, there is also the way of using <code>std::string</code>. I think the way of using std::string is the most elegant. While looking at other code, I often see that people either <code>use const char *</code> or <code>char s []</code>. Thus, my question is now, when should I use <code>const char * s1</code> or <code>char s []</code> or <code>std::string</code>? What are the differences and in which situations should I use which approach?</p>
