# sum.c -- summary of C language # $Id$ # Carlos Duarte , 980630 Flow control if (expr) stmt1 [else stmt2] while (expr) stmt for ([expr1]; [expr2]; [expr3]) stmt do stmt while (expr) break break from inner for,while,do,switch continue jump next iteration of for,while,do return [(expr)] return `expr' from function label: place `label' goto label jump to `label' { [stmt(s);] } switch (integral) { check for possible values of `integral' case val1: list one possible value case val2: list other possible value ... default: default, if none other is matched } Operators and precedence Assoc. Operators Description L () [] -> . R ! ~ ++ -- + - * & (type) sizeof L * / % mul, div, mod L + - add, sub L << >> lshift, rshift L < <= > >= lt, le, gt, ge L == != equal, diff L & bitwise AND L ^ bitwise XOR L | bitwise OR L && logical AND L || logical OR R ?: a?b:c = if (a) b else c R = += -= *= /= %= &= ^= |= <<= >>= assign, do op then assg L , . L: left to right . R: right to left . table from K&R, 2nd ed, pg. 53 . precedence decreases down Escapes on strings and characters esc desc usage dec oct hex \0 nul '\0' 0 000 00 \a bel '\a' 7 007 07 \b bs '\b' 8 010 08 \t ht '\t' 9 011 09 \n lf '\n' 10 012 0A \v vt '\v' 11 013 0B \f ff '\f' 12 014 0C \r cr '\r' 13 015 0D \\ \ '\\' 92 134 5C \? ? '\?' 63 077 3F \" " '\"' 34 042 22 \' ' '\'' 39 047 27 \ooo oct ooo '\377' - ooo - \xhh hex hh '\xff' - - hh . usage column, is relative to chars; to use on strings, double quotes should be used: char '\n', string "\n"