摘要:
1、函数原型 #include <stdio.h> char *strncat(char *s1, const char *s2, size_t n) //函数的返回值为指向char型的指针,形参为两个指针(函数间数组(字符串数组)的传递是以指向数组第一个元素的指针进行的)和正整数n。 { char 阅读全文
posted @ 2021-06-01 11:29
小鲨鱼2018
阅读(300)
评论(0)
推荐(0)
摘要:
1、函数原型 #include <stdio.h> char *strcat(char *s1, const char *s2) //函数返回类型为指针,形参为两个指针(为字符串数组的数组名,相当于指向数组第一个元素的指针) { char *tmp = s1; //将指针tmp赋值为s1指针,也就是 阅读全文
posted @ 2021-06-01 10:21
小鲨鱼2018
阅读(1812)
评论(0)
推荐(0)
摘要:
1、函数原型。 #include <stdio.h> char *strncpy(char *s1, const char *s2, size_t n) //函数的返回值为指针,形参为两个指针(字符串数组,相当于指向第一个字符的指针)和n(赋值字符个数)。 { char *tmp = s1; //将 阅读全文
posted @ 2021-06-01 09:49
小鲨鱼2018
阅读(1791)
评论(0)
推荐(0)
摘要:
1、函数原型(字符串的复制) #include <stdio.h> char *strcpy(char *s1, const char *s2) //函数的返回值为指向char型的指针, 形参为指向char型的指针 { char *tmp = s1; // 将指针tmp声明为s1,s1为传入的字符串 阅读全文
posted @ 2021-06-01 09:21
小鲨鱼2018
阅读(1705)
评论(0)
推荐(0)
摘要:
1、函数原型(利用指针求字符串的长度) #include <stdio.h> size_t strlen(const char *s) //函数头的形参为常数的、指向char型的指针,也就是接收的形参为指针(实际上传入的是字符串数组,函数间数组的传递实际上是通过指向第一个元素的指针完成的) { // 阅读全文
posted @ 2021-06-01 08:57
小鲨鱼2018
阅读(2521)
评论(0)
推荐(0)