1 # include "usart. H "2 int main () 3 {4 usartmediaconfig (); // serial port initialization, the following information is printed through the serial port 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}
The preceding Code defines the length of common data types in the Keil MDK compiler.
The result is as follows:
CHAR: 1
Unsigned char: 1
Short: 2
Unsigned short: 2
INT: 4
Unsigned INT: 4
Long: 4
Unsigned long: 4
Float: 4
Double: 8