CS 24000 Study Guide - Midterm Guide: Entry Point, In C, Octal
Document Summary
Constants: same as java. const double pi = 3. 14192654, constants cannot be changed, also it is common in c to use the c pre- processor to define variables. Assignments: the element in the left side has to be an l-value . An l-value can be interpreted as an address: a variable is an l-value but a constant is not an l-value, x = 5; l-value, 8 = 5; not l-value. In c, an assignment is an expression: this implies that an assignment may appear anywhere an expression is allowed. Example: j = (i = 5) +3; // this will assign 5 to i and it will assign 8 to j: example: while( (c = getchar() ) != -1){ } 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.