指针
Bermotto
学生
展开
-
指针字符串训练所得((考察指针传参))
编写字符串比较函数mystrcpy,其功能:对两个字符串进行比较,若这两个字符串相等,则返回0,并若这两个字符串不相等,则返回它们第一个不同字符的ASCII码差。 #include<stdio.h> #include<string.h> int compare(char*, char*); int main() { int a; char str1[100], str2[100]; printf("请输入两个字符串\n"); gets_s(str1); gets_s(str原创 2021-04-02 20:32:28 · 72 阅读 · 1 评论 -
#指针应用一:代替并遍历数组元
指针应用一:代替并遍历数组元素 简化版自定义strcat函数(要求不允许应用函数库)# 一级标题 #include<stdio.h> #include<string.h> char* cat(char *, char *);/函数声明(自定义的strcat)/ int main() { char str1[100]; char str2[100]; gets_s(str1); gets_s(str2);/读入字符串/ cat(str1, str2);/对字符串进行拼接/ puts(s原创 2021-04-02 10:48:39 · 156 阅读 · 1 评论