📄 ex1.c
字号:
#include<stdlib.h> //头文件
#include<stdio.h>
#include <reg51.h>
void main(void) //主函数
{
char str1[]="1212"; //声明并初始化变量
char str2[]="987654321";
char str3[]="37.14";
int i; //声明变量
long l;
float f;
//初始化串口
i=atoi(str1); //调用atoi函数
printf("atoi(%s)=%d\n",str1,i); //输出结果
l=atol(str2); //调用atol函数
printf("atol(%s)=%ld\n",str2,l); //输出结果
f=atof(str3); //调用atof函数
printf("atof(%s)=%f\n",str3,f); //输出结果
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -