------------------------------------------------------------------------------
MC logo
Plain C Strings
[^] CSc 220 Home
------------------------------------------------------------------------------
[Introduction] [Boolean and Control] [Functions] [Arrays and Pointers] [Dynamic Arrays] [Array Errors] [Command Array] [Standard Containers] [Structs and Classes] [Automatic Pointer] [Multi-File Programs] [Copying Objects] [Templates] [Inheritance] [Plain C I/O] [Type Odds And Ends] [Plain C Strings] [File I/O]
[C Strings] [More C Strings] [Plain C Arg Lister] [Fancy Plain C Arg Lister (With Pointers)] [Simple String Sort]
Plain C strings are arrays of character, terminated with a zero byte. An array of N characters can hold strings from length 0 to N-1, needing one extra byte to store the terminator. As such, C strings inherit many of the afflictions of C arrays, and their relationship with pointers.

The standard libraries provide a series of methods to handle plain C strings, all named starting with str: strlen, strcat, strcpy, etc. These are accessed with #include , as opposed to #include for the C++ strings.

Double-quoted constants are plain-C strings, and provide char pointer values in expressions, so assigning one to a C++ string string actually performs a conversion. I believe this may change in future C++ standards.