0

I've a question regarding strings. As far as I knew, strings in C is are arrays of Characters. Now I've learned that it is in fact just a pointer to the first Character. As far as I know, arrays don't need pointers because the just can be treated as one themself. So what is a strings now?

Thank you!

Research and reading up

  • 1
    Strings are character arrays ending with a null terminator and that's pretty much it. You can point to the first item with a pointer if you fancy, but that doesn't change that the string itself is still a null-terminated character array. "Now I've learned that it is in fact just a pointer to the first Character." No, an array "decays" into a pointer to the first character whenever used in an expression, but that's not something unique to strings. – Lundin Dec 06 '22 at 09:13

0 Answers0