谁有STM32F103VB 的485多机通信的例程

2025-03-21 00:22:02
推荐回答(1个)
回答1:

本程序中把输入的字符串和数组st2中的串比较,比较结果返回到k中,根据k值再输出结果提示串。当输入为dbase时,由ASCII 码可知“dBASE”大于“C Language”故k〉0,输出结果“st1>st2”。
6. 测字符串长度函数strlen
格式: strlen(字符数组名)
功能:测字符串的实际长度(不含字符串结束标志‘\0’) 并作为函数返回值。
【例7.17】
#include"string.h"
main()
{ int k;
static char st[]="C language";
k=strlen(st);
printf("The lenth of the string is %d\n",k);
}
7.4 程序举例