CS 24000 Lecture Notes - Lecture 4: Centered Hexagonal Number
Document Summary
Integer constants: 1 2 3 4 decimal, 031 octal constant 3*8+1 = 25 starts with 0, 0x4a3 hexadecimal constant 4*16^2+10*16+3= or in binary 0100 1010. 0011: the type of integer constant will be: int if v does not exceed the int range. long if v exceeds an int but not a long, unsigned long if v exceeds long. Integer constants: you can add suffix to force type, 123456789l long, 55u unsigned int, 234lu unsigned long. Floating-point constants: 3. 14 type is always double, to force the type float, add f suffix, 3. 14f float constant. "q" enclosed with a single quote: also you can use escape sequences with "\octal number" e. g. "\020", ascii: 2*8+0=16. "\hex number with two digits" e. g. "\ae": ascii: 10*16+14. Character constants: also there are some common escape sequences "\n" new line. Character constants: character constants have type int, int i, i = "a"; //assign ascii 65 to i.