Chapter 3 Data types, Operators, and Expressions UInteger constants Decimal integer: as in 123,-456, 0 Octal integer: a leading 0 (zero) on an integer constant means octal. as in 0123.011 Hexadecimal integer: a leading Ox or oX on an integer constant means hexadecimal. as in 0x123, OXff 注 同题: A10n0123 )ho en with a terminal 1(el1)o0×123= )1o I gned constants are written0×f=( )10 U, and the suffix u or UL indruatUD unSisnrcu Tong, as in 123u, Oxful 例30000为int型 65536为1 ong int型 例12与12L
12 ❑Integer constants Decimal integer:as in 123,-456,0…… Octal integer:a leading 0(zero) on an integer constant means octal. as in 0123,011…… Hexadecimal integer:a leading 0x or 0X on an integer constant means hexadecimal.as in 0x123,0Xff…… < 注: A long constant is written with a terminal l(ell) or L,as in 123L; unsigned constants are written with a terminal u or U,and the suffix ul or UL indicates unsigned long,as in 123u,0xful…… 问题: 0123 = ( )10 0x123 = ( )10 0Xff = ( )10 83 291 255 问题: 0123 = ( )10 0x123 = ( )10 0Xff = ( )10 Chapter 3 Data types , Operators , and Expressions 例 例 12 与 12L 30000 为int型 65536 为long int 型
Chapter 3 Data types, Operators, and Expressions OFloating-point constants Decimal form: (must have decimal point) as in 0.123,.123,123.0,0.0,123. Exponential form: (must have digits before e or E; exponent must be integer) as in 12.3e3,123E2,1.23e4,e-5,1.2E-3.5 注 The type of floating-point constants is double unless suffixed. The suffixes f or f indicate a float constant; I or L indicate a long double
13 ❑Floating-point constants Decimal form:(must have decimal point) as in 0.123, .123, 123.0, 0.0, 123. …… Exponential form:(must have digits before e or E; exponent must be integer) as in 12.3e3 ,123E2, 1.23e4 , e-5 , 1.2E-3.5 < 注: The type of floating-point constants is double ,unless suffixed.The suffixes f or F indicate a float constant;l or L indicate a long double. Chapter 3 Data types , Operators , and Expressions