Keil MDK编译器的数据类型定义

时间:2014-08-10 18:32:10   收藏:0   阅读:322
 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



Keil MDK编译器的数据类型定义,布布扣,bubuko.com

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!