Constants in C
We have already seen decimal integer constants in the previous example(A Working C Program; Variables; Types and Type Declarations)in -- 1, 2, and 3. Since C is often used for system programming and bit-manipulation, octal numbers are an important part of the language. In C, any number that begins with 0 (zero!) is an octal integer (and hence can't have any 8's or 9's in it). Thus
0777
is an octal constant, with decimal value 511.A ``character'' is one byte (an inherently machine-dependent concept). Most often this is expressed as a character constant, which is one character enclosed in single quotes. However, it may be any quantity that fits in a byte, as in flags below:char quest, newline, flags; quest = '?'; newline = '\n'; flags = 077;The sequence `\n' is C notation for ``newline character'', which, when printed, skips the terminal to the beginning of the next line. Notice that `\n' represents only a single character. There are several other ``escapes'' like `\n' for representing hard-to-get or invisible characters, such as `\t' for tab, `\b' for backspace, `\0' for end of file, and `\\' for the backslash itself.
float
and double
constants are discussed in Following posts
0 comments:
Post a Comment