Tham khảo tài liệu 'praise for c# : practical guide for programmers 2005 phần 4', công nghệ thông tin, kỹ thuật lập trình phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả | Literals 63 Literals The C language has six literal types integer real boolean character string and null. Integer literals represent integral-valued numbers. For example 123 is 0123 is 123U is 123L is 123UL is 0xDecaf is an integer by default an octal integer using the prefix 0 an unsigned integer using the suffix U a long integer using the suffix L an unsigned long integer using the suffix UL a hexadecimal integer using the prefix 0x Real literals represent floating-point numbers. For example .1e12 are double precision by default 3E12 are double precision by default is a single precision real using the suffix F is a double precision real using the suffix D is a decimal real using the suffix M Suffixes may be lowercase but are generally less readable especially when making the distinction between the number 1 and the letter l. The two boolean literals in C are represented by the keywords Tip true false The character literals are the same as those in C but also include the Unicode characters udddd continuation n t b r f 0ddd or ddd 0xdd or xdd 0xdddd or udddd Therefore the following character literals are all equivalent n 10 012 0xA u000A x000A String literals represent a sequence of zero or more characters for example A string an empty string a double quote Finally the null literal is a C keyword that represents a null reference. 64 Chapter 4 Unified Type System Conversions In developing C applications it may be necessary to convert or cast an expression of one type into that of another. For example in order to add a value of type float to a value of type int the integer value must first be converted to a floating-point number before addition is performed. In C there are two kinds of conversion or casting implicit and explicit. Implicit conversions are ruled by the language and applied automatically without user intervention. On the other hand explicit conversions are specified by the developer in order to support runtime