Elements of C

Morton H. Lewin

Language: English

Published: Dec 6, 2012

Description:

Statements in C, like statements in any other programming language, consist almost entirely of expressions and special reserved words. Declarations in C, unlike declarations in other languages, also contain arbitrary expressions. Thus, studying the means by which C expressions are constructed and evaluated is especially important-particularly since the number of permissible C operators is so large. Since all of the operands in a C expression (excluding constants) must be properly declared before they are used, and since declarations themselves contain expressions, the teaching of C involves the following chicken-and-egg problem: Should one begin by considering only elementary declarations, in which case the topic of expression construction and evaluation cannot be fully treated in one place, because the operators that pertain to the more complex objects-like pointers and structures (whose declarations have not yet been introduced)--have not yet been covered, or should one postpone entirely the issue of how decla rations are written (merely assuming that all of the objects under discussion have been properly declared) in order to fully treat all types of operands and operators in one comprehensive discussion? If the student is encouraged to begin writing programs immediately, the former choice is mandatory, because even the most elementary programs must vII Preface viii contain proper declarations. Thus, most C textbooks postpone the discussion of objects like arrays, structures, and pointers (and of the operators that pertain to them) until the second half of the book is reached.