title: How do strings and char arrays work in C?
body: <p>No guides I've seen seem to explain this very well.</p>
  
  <p>I mean, you can allocate memory for a <code>char*</code>, or write <code>char[25]</code> instead? What's the difference? And then there are literals, which can't be manipulated? What if you want to assign a fixed string to a variable? Like, <code>stringVariable = "thisIsALiteral"</code>, then how do you manipulate it afterwards?</p>
  
  <p>Can someone set the record straight here? And in the last case, with the literal, how do you take care of null-termination? I find this very confusing.</p>
  
  <hr>
  
  <p>EDIT: The real problem seems to be that as I understand it, you have to juggle these different constructs in order to accomplish even simple things. For instance, only <code>char *</code> can be passed as an argument or return value, but only <code>char[]</code> can be assigned a literal and modified. I feel like it's obvious that we frequently/always needs to be able to do both, and that's where my pitfall is.</p>