Strings and character sequences

Is it better to use strings or character pointers to take input? I've only learned how to use character pointers as I'm learning from a book, are strings complicated to use? They seem simple enough to me.
And which one would provide better security?
Depends on your requirements. std::strings are easy to manage, but they are slower and use more memory (not much more, though).
C strings have no memory overhead, but you need to do the memory management yourself.

Define "security".
Security... well I think you've told me enough. I just meant which one is easier to break and modify for hacking and so.
I asked because you could mean security as in which one is harder to corrupt (due to overflow and such).
If that's what you mean by security, then both are the same (std::strings store a pointer to a C string).
Last edited on
Topic archived. No new replies allowed.