The C Programming Language

is an excellent book by Dennis Ritchie and Brian Kernighan (isbn 0131103628). As usual I'm going to quote from a few pages:
C provides no operations to deal directly with composite objects.
Any characters between /* and */ are ignored by the compiler; they may be used freely to make a program easier to understand.
The precision of both int and float depends on the particular machine you are using.
Individual statements are terminated by semicolons.
Statements controlled by the while are indented by one tab stop so you can see at a glance what statements are inside the loop.
We recommend writing one statement per line, and (usually) leaving blanks around operators.
It's bad practice to bury "magic numbers" like 300 and 20 in a program; they convey little information to someone who might have to read the program later, and they are hard to change in a systematic way.
Nesting an assignment in a test is one of the places where C permits a valuable conciseness. (It's possible to get carried away and create impenetrable code, though, a tendency that we will try to curb.)
Expressions connected by && or || are evaluated left to right, and it is guaranteed that evaluation will stop as soon as the truth or falsehood is known.
Array subscripts always start at zero in C.
A function provides a convenient way to encapsulate some computation in a black box, which can then be used without worrying about its innards… C is designed to make the use of functions easy, convenient and efficient; you will often see a function only a few lines long called only once, just because it clarifies some piece of code.
You should note that we are using the words declaration and definition carefully when we refer to external variables in this section. "Definition" refers to the place where the variable is actually created or assigned storage; "declaration" refers to places where the nature of the variable is stated but no storage is allocated.
The evaluation order is not specified for associative and commutative operators like * and +; the compiler may rearrange a parenthesized computation involving one of these. Thus a+(b+c) can be evaluated as (a+b)+c. This rarely makes any difference, but if a particular order is required, explicit temporary variables must be used.

2 comments:

  1. good collection of lines

    ReplyDelete
  2. Thanks .. your blog is very informative.

    ReplyDelete