The C Programming Language
(Ritchie & Kernighan)
What is a C Programming language??C is an imperative (procedural) systems implementation language. Its design goals were for it to be compiled using a relatively straightforward compiler, provide low-level access to memory, provide language constructs that map efficiently to machine instructions, and require minimal run-time support. C was therefore useful for many applications that had formerly been coded in assembly language. Despite its low-level capabilities, the language was designed to encourage machine-independent programming. A standards-compliant and portably written C program can be compiled for a very wide variety of computer platforms and operating systems with minimal change to its source code. The language has become available on a very wide range of platforms, from embedded microcontrollers to supercomputers.C''s characteristicLike most imperative languages in the ALGOL tradition, C has facilities for structured programming and allows lexical variable scope and recursion, while a static type system prevents many unintended operations. Parameters of C functions are always passed by value. Pass-by-reference is achieved in C by explicitly passing pointer values. Heterogeneous aggregate data types (struct) allow related data elements to be combined and manipulated as a unit. C program source text is free-format, using semicolon as a statement terminator (not a delimiter). C has around 30 reserved keywords. C also exhibits the following more specific characteristics: non-nestable function definitions, although variables may be hidden in nested blockspartially weak typing; for instance, characters can be used as integerslow-level access to computer memory by converting machine addresses to typed pointersfunction pointers allowing for a rudimentary form of closures and runtime polymorphismarray indexing as a secondary notion, defined in terms of pointer arithmetica preprocessor for macro definition, source code file inclusion, and conditional compilationcomplex functionality such as I/O, string manipulation, and mathematical functions consistently delegated to library routinessyntax divergent from ALGOL, often following the lead of C''s predecessor B, for example using { ... } rather than ALGOL''s begin ... endthe equal-sign for assignment (copying), much like Fortrantwo consecutive equal-signs to test for equality (compare to .EQ. in Fortran or the equal-sign in BASIC)&& and || in place of ALGOL''s and and or, which are syntactically distinct from the bit-wise operators & and | (used by B for both meanings)never evaluate the right operand if the result can be determined from the left alone (short-circuit evaluation) a large number of compound operators, such as +=, ++, etc.
Resumos Relacionados
- System Software
- Computer System Architecture
- Codds Rules -relational Database Management System
- Codds Rules -relational Database Management System
- Being Popular
|
|