C primer notes.
Support two strings: C style string and String type introduced by ANSI C
C style string, use char * pointer to manipulate
The standard C library provides a set of functions for operation, such as:
Int strlen; const char *);
INT strcmp (const char *, const char *);
Char * STRCPY (Char *, const char *);
Related header files: #include
There are two representation of the C style string length of 0, and the corresponding pointer is 0: char * PCH = 0; or point to the empty string: char * pch = "
/ ******* CSTR.cpp ******* / # include
INT main (int Argc, char * argv []) {int LEN = 0; const char * p = st;
While (* p ) Len;
COUT << LEN << ":" << ST << end1; return 0;} / ********* * end of the .cpp file ********* /
Compilation: g -o cstr cstr.cpp
Run: cstr.exe
Output results:
22: The Expense of Spirit