2021年10月11日
摘要: 一、概述 案例:使用C语言实现字符串的逆序,用数组和指针两种方式实现。 二、代码示例 #include <iostream> #include <string.h> using namespace std; //字符串逆序,数组实现 void reserveStr(char *src,char* r 阅读全文
posted @ 2021-10-11 17:00 飘杨...... 阅读(899) 评论(0) 推荐(0)
摘要: 一、概述 案例:利用for改造上一节的服务端程序,让其能够和多个客户端之间收发数据。Client端代码请参考上一篇 二、代码示例 #include <iostream> #include <sys/socket.h> #include <netinet/in.h> #include <unistd. 阅读全文
posted @ 2021-10-11 13:14 飘杨...... 阅读(237) 评论(0) 推荐(0)
摘要: 一、概述 案例:使用C语言编写一个函数,来实现字符串的copy。 二、代码示例 #include <iostream> using namespace std; /** * 使用数组 copy * */ void mystrcopy(char *str1,char* str2){ int i =0; 阅读全文
posted @ 2021-10-11 11:19 飘杨...... 阅读(1446) 评论(0) 推荐(0)
摘要: 一、概述 案例:使用C语言编写一个函数,次函数中实现两个阿拉伯数字的值的交换。 二、代码实例 #include <iostream> using namespace std; void swap(int,int); void swap2(int * ,int *); int main(int arg 阅读全文
posted @ 2021-10-11 11:06 飘杨...... 阅读(213) 评论(0) 推荐(0)
摘要: 一、概述 案例:使用C语言编写一个方法比较两个字符串是否相等如果相等则返回0,否则返回不等于0的数字。 二、代码示例 #include <iostream> using namespace std; /** * 比较两个字符串是否相等 * */ int mystrcmp(char *str1,cha 阅读全文
posted @ 2021-10-11 11:03 飘杨...... 阅读(1557) 评论(0) 推荐(0)