[Study Notes] [C Language] type specifier, Study Notes C Language
1. short and long
3. Code
1 # include <stdio. h> 2/* 3 int 4 bytes % d 4 short 2 bytes % d 5 long 8 bytes % ld 6 long 8 bytes % lld 7 8 9 signed10 unsigned % u11 */12 int main () 13 {14 // 0000 0000 0000 0000 0000 0000 0000 000015 // The 31 power of 2-116 // The 32 power of 2-117 int num; 18 19/* 20 what is the difference between signed and unsigned: the highest bit of 21 signed should be regarded as the highest bit of 22 unsigned, not as the highest bit of 23 */24 // signed = signed int25 // signed: positive, 0, negative 26 signed int a = 10; 27 signed a2 = 10; 28 29 // unsigned int = unsigned30 // unsigned: 0, positive 31 unsigned int B = 10; 32 unsigned b2 = 10; 33 34 long unsigned int c = 34343; 35 long unsigned c2 = 423432; 36 37 short unsigned int d = 4343; 38 short unsigned d2 = 43243; 39 40 short signed int e = 54354; 41 short signed e2 = 434; 42 43 45 46 return 0; 47} 48 49 void longAndShort () 50 {51 // long = long int52 long int a = 100645654654645645l; 53 long a2 = 100645654654645645l; 54 55 // long int = long long56 long int c = 100645654654645645ll; 57 long c2 = 1095435435435ll; 58 59 // short = short int60 short int d = 5454; 61 short d2 = 43434; 62 63 // printf ("% lld \ n", c); 64 65 int s = sizeof (long int ); 66 printf ("% d \ n", s); 67}