首页 > 代码库 > Keil MDK编译器的数据类型定义
Keil MDK编译器的数据类型定义
1 #include "usart.h" 2 int main() 3 { 4 USART1_Config(); //串口初始化,以下信息通过串口打印 5 printf("char: %d\r\n",sizeof(char)); 6 printf("unsigned char: %d\r\n",sizeof(unsigned char)); 7 printf("short: %d\r\n",sizeof(short)); 8 printf("unsigned short: %d\r\n",sizeof(unsigned short)); 9 printf("int: %d\r\n",sizeof(int));10 printf("unsigned int: %d\r\n",sizeof(unsigned int));11 printf("long: %d\r\n",sizeof(long));12 printf("unsigned long: %d\r\n",sizeof(unsigned long));13 printf("float: %d\r\n",sizeof(float));14 printf("double: %d\r\n",sizeof(double));15 while(1);16 }
通过以上一段代码,得到了Keil MDK编译器对常用数据类型长度的定义。
结果如下:
char: 1
unsigned char: 1
short: 2
unsigned short: 2
int: 4
unsigned int: 4
long: 4
unsigned long: 4
float: 4
double: 8
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。