📄 12-2-1.c
字号:
#include<string.h> //头文件
#include<stdio.h>
#include <reg51.h>
void main(void) //主函数
{
static char str[20]="This is a test!";
void *c;
SCON=0x50; //串口模式1,允许接收
TMOD|=0x20; //初始化T1为定时功能,模式2
PCON|=0x80; //设置SMOD=1
TL1=0xF4; //波特率4800bit/s,初值
TH1=0xF4;
IE|=0x90; //中断
TR1=1; //启动定时器
c=memchr(str,'a',sizeof(str)); //调用函数
if(c==NULL) //未找到字符
printf("'a' was not found in the str\n");
else //找到字符
printf("found 'a' in the str\n");
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -