Recently I spent a whole lot of time on file compression and decompression with zlib. Thought I’d better write something about it. But before that, let me finish the review of C++ fundamentals. Today I’ll write about Strings in C++.
Two types of String are available in C++: C-Strings (C-style Strings), and STL Strings.
C-String
C-String is a fundamental type in C++. Comparing to STL String, C-String is small, simple and fast. A C-String is a special case of an array of characters terminated with a 0. This is sometimes called an null-terminated string. A C-String can be printed out with a printf
statement using the %s
format string. We can access the individual characters in a C-String just as we do in an array.