C语言基础10

73 阅读1分钟

1.字符串有关的头文件#include<string.h>

2.使用strcpy拷贝字符串#include<string.h>

3.strncpy不拷贝\n-strcpy拷贝

4.strcat(s1,s2)保证s1足够大追加字符串

  1. 比较字符串大小strcmp--#include<string.h>---strncmp比较前n个字符

  2. 字符串中查找字符strchr(查找的字符减去第一个)--strrchr(查找的字符减去最后一个)

image.png

7.在字符串中查找字符串strstr

image.png