c/c++之strcat函数
我们首先来看这样一段代码: # include <iostream> # include <string.h> using namespace std ; int main ( ) { char pointer [ 24 ] = "Hello,world" ; cout << "The length of pointer:" << strlen ( pointer ) << endl ; strcat ( pointer , "China." ) ; cout << pointer << endl ; strcpy ( pointer , "Hello,world" ) ; strcat ( pointer + 3 , "China." ) ; cout << pointer << endl ; strcpy ( pointer , "Hello,world" ) ; strcat ( pointer + 8 , "China." ) ; cout << pointer << endl ; strcpy ( pointer , "Hello,world" ) ; strcat ( pointer + 11 , "China." ) ; cout << pointer << endl ; strcpy ( pointer , "Hello,world" ) ; strcat (