C The basic data types of language are 9 species : plastic int, Long plastic long, Short short, character char, Solid type : Monosperm type (float type ), Double precision (double),void, Signed signed, Unsigned unsigned.

stay 32 Bit compiler , The bytes occupied by each data type are as follows :
printf("int occupy %d Bytes \n", sizeof(int)); printf("float occupy %d Bytes \n", sizeof(float));
printf("double occupy %d Bytes \n", sizeof(double)); printf("char occupy %d Bytes \n", sizeof(char));
printf("long occupy %d Bytes \n", sizeof(long)); printf("short occupy %d Bytes \n", sizeof(short));
The output results are as follows :
int occupy 4 Bytes float occupy 4 Bytes double occupy 8 Bytes char occupy 1 Bytes long occupy 4 Bytes short occupy 2 Bytes
  The output form of each data type is as follows :
int a = 1; float b = 1.0; double c = 1.0; char ch = 'A'; long d = 1; printf("a
= %d,b = %f,c = %lf,ch = %c,d = %ld", a, b, c, ch, d);
  in addition ,float,double retain n Decimal representation :%.nf,%.nlf.

also %md:m Refers to the minimum width of positioning output data . If the number of data bits is less than m, This fills the left end with space , If greater than or equal to m, Then output by actual digits , At this time, it can be matched with the modifier “-” and “0” To control , as follows :
int a = 1234; printf("%d\n", a); printf("%3d\n", a); printf("%8d\n", a);
printf("%08d\n", a); printf("%-8d\n", a);
The output results are as follows :
1234 1234 1234 00001234 1234
Observe the differences and characteristics carefully .

This is the end of the introduction here !!!

 

 

Technology