1.引入頭文件#include<string.h>ios
2.字符串函數的介紹數組
經常使用的幾個函數以下所示:
url
strlen求字符串長度spa
strcmp比較2個字符串是否同樣htm
strcat字符串鏈接操做ip
strcpy字符串拷貝操做內存
strncat字符串鏈接操做(前n個字符)字符串
strncpy字符串拷貝操做(前n個字符)get
strchr查詢字串
strstr 查詢子串
附:引用頭文件
#include <assert.h> //設定插入點
#include <ctype.h> //字符處理
#include <errno.h> //定義錯誤碼
#include <float.h> //浮點數處理
#include <fstream.h> //文件輸入/輸出
#include <iomanip.h> //參數化輸入/輸出
#include <iostream.h> //數據流輸入/輸出
#include <limits.h> //定義各類數據類型最值常量
#include <locale.h> //定義本地化函數
#include <math.h> //定義數學函數
#include <stdio.h> //定義輸入/輸出函數
#include <stdlib.h> //定義雜項函數及內存分配函數
#include <string.h> //字符串處理
#include <strstrea.h> //基於數組的輸入/輸出
#include <time.h> //定義關於時間的函數
#include <wchar.h> //寬字符處理及輸入/輸出
#include <wctype.h> //寬字符分類