The C Programming Language is a computer programming book written by Brian Kernighan and Dennis Ritchie, the latter of whom originally designed and. The C Programming Language has ratings and reviews. RIP Ritchie (): “The C Programming Language” by Kernighan and Ritchie. Il linguaggio C. Principi di programmazione e manuale di riferimento. Ediz. MyLab (Mixed media product) by Dennis M. Ritchie, Brian W. Kernighan and a great.

Author: Goran Mezit
Country: Poland
Language: English (Spanish)
Genre: Marketing
Published (Last): 2 April 2005
Pages: 254
PDF File Size: 4.16 Mb
ePub File Size: 16.90 Mb
ISBN: 600-2-90428-400-3
Downloads: 3220
Price: Free* [*Free Regsitration Required]
Uploader: Voodoonris

By design, C provides constructs that map efficiently to typical machine instructionsand therefore it has found lasting use in applications that had formerly been coded in assembly languageincluding operating systemsas well as various application software for computers ranging from supercomputers to embedded systems.

C was originally developed by Dennis Ritchie between and at Bell Labs[6] and used to re-implement the Unix operating system. C is an imperative procedural language. It was designed to be compiled using a relatively straightforward compilerto provide low-level access to memoryto provide language constructs that map efficiently to machine instructionsand to require minimal run-time support.

Despite its low-level capabilities, the language was designed to encourage cross-platform programming.

A standards -compliant C program that is written with portability in mind can be compiled for a very wide variety of computer platforms and operating systems with few changes to its source code. The language has become available on a very wide range of platforms, from embedded microcontrollers to supercomputers. Like 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.

In C, all executable code is contained within subroutineswhich are called “functions” although not in the strict sense of functional programming.

Function parameters are always passed by value. Pass-by-reference is simulated in C by explicitly passing pointer values. C program source text is free-formatusing the semicolon as a statement terminator and curly braces for grouping blocks of statements.

While C does not include some features found in some other languages, such as object orientation or garbage collectionsuch features can be implemented or emulated in C, often by way of external libraries iernighan. Most of them with Python being the most dramatic exception are also very syntactically similar to C in general, and they tend to combine the recognizable expression and statement syntax of C with underlying type systems, data models, and semantics kernigjan can be radically different.

The origin of C is closely tied to the development of the Unix operating system, originally implemented in assembly language on a PDP-7 by Dennis Ritchie and Ken Thompson, incorporating several ideas from colleagues. Eventually, they decided to port the operating system to a PDP The original PDP version of Unix was developed in assembly language.

The name of C was chosen simply as the next after B. Also ina large part of Unix was rewritten in C. Unix was one of the first operating system kernels implemented in a language other than assembly.

In aroundRitchie and Stephen C. Johnson made further changes to the language to facilitate portability of the Unix operating system.

Johnson’s Portable C Compiler served as the basis for several implementations of C on new platforms. In early versions of C, only functions that return types other than int must be declared if used before the function definition; functions used without prior declaration were presumed to return type int. Separate tools such as Unix’s lint utility were developed that among other things could check for consistency of function use across multiple source files.

During the late s and s, versions of C were implemented for a wide variety of mainframe computersminicomputersand microcomputersincluding the IBM PCas its popularity began to increase significantly. Therefore, the terms “C89” and “C90” refer to the same programming language. National adoption of an update to the international standard typically occurs within a year of ISO publication. C89 is supported by current C compilers, and most C code being written today is based on it.


Any program written only in Standard C and without any hardware-dependent assumptions will run correctly on any platform with a conforming C implementation, within its resource limits. Without such precautions, programs may compile only on a certain platform or with a particular compiler, due, for example, to the use of non-standard libraries, such as GUI libraries, or to a reliance on compiler- or platform-specific attributes such as the exact size of data types and byte endianness.

It has since been amended three times by Technical Corrigenda. Many of these had already been implemented as extensions in several C compilers.

C99 is for the most part backward compatible with C90, but is stricter in some ways; in particular, a declaration that lacks a type specifier no longer has int implicitly assumed.

Inwork began on another revision of the C standard, informally called “C1X” until its official publication on The C standards committee adopted guidelines to limit the adoption of new features that had not been tested by existing implementations. The C11 standard adds numerous new features to C and the library, including type generic macros, anonymous structures, improved Unicode support, atomic operations, multi-threading, and bounds-checked functions.

Published in JuneC18 is the current standard for the C programming language. It introduces no new language features, only technical corrections and clarifications to defects in C Inthe C Standards Committee published a technical report extending the C language [21] to address these issues by providing a common standard for all implementations to adhere to.

C has a formal grammar specified by the C standard. C source files contain declarations and function definitions. Function definitions, in turn, contain declarations and statements. Declarations either define new types using keywords such as structunionand enumor assign types to and perhaps reserve storage for new variables, usually by writing the type followed by the variable name.

Keywords such as char and int specify built-in types. As an imperative language, C uses statements to specify actions.

The most common statement is an expression statementconsisting of an expression to be evaluated, followed by a semicolon; as a side effect of the evaluation, functions may be called and variables may be assigned new values.

To modify the normal sequential execution of statements, C provides several control-flow statements identified by reserved keywords. Structured programming is supported by if – else conditional execution and by do – whilewhileand for iterative execution looping.

The for statement has separate initialization, testing, and reinitialization expressions, any or all of which can be omitted. There is also a non-structured goto statement which branches directly to the designated label within the function.

Linguaggio C – Brian W. Kernighan, Dennis M. Ritchie – Google Books

Expressions can use a variety of built-in operators and may contain function calls. The order in which arguments to functions and operands to most operators are evaluated is unspecified. The evaluations may even be interleaved. However, all side linnguaggio including storage to variables will occur before the next ” sequence point “; sequence lingusggio include the end of each expression statement, and the entry to and return from each function call.

This permits a high degree of object code optimization by the compiler, but requires C programmers to take more care to obtain reliable results than is needed for other programming linguatgio. Some of the operators have the wrong precedence; some parts of the syntax could be better. Newline indicates the kerhighan of a text line; it linguagguo not correspond to an actual single character, although for convenience C treats it as ilnguaggio. Additional multi-byte encoded characters may be used in string literals, but they are not entirely portable.

The basic C execution character set contains the same characters, along with representations for alertbackspaceand carriage return. Run-time support for extended character sets has increased with each revision of the C standard. C89 has 32 reserved words, also known as keywords, which are the words that cannot be used for any purposes other than those for which they are predefined:. C11 reserved seven more words: Most of the recently ritchei words begin with an underscore followed by a capital letter, because identifiers of that form were previously reserved by the C standard for use only by implementations.


Since existing program oernighan code should not have been using these identifiers, it would not be affected when C implementations started supporting these extensions to the programming language. Some standard headers do define more convenient synonyms for underscored identifiers. The language previously included a reserved word called entrybut this was seldom implemented, and has now been removed as a reserved word.

C supports a rich set of operatorswhich are symbols used within an expression to specify the manipulations to be performed while evaluating that expression. C has operators for:. The similarity between these two operators assignment and equality may result in the accidental use of one in place of the other, and in many cases, the mistake does not produce an error message although some compilers produce warnings.

The C operator precedence is not always intuitive. The program prints “hello, world” to the standard outputwhich is usually a terminal or screen display.

The original version was: A standard-conforming “hello, world” program is: The first line of the program contains a preprocessing directiveindicated by include. This causes the compiler to replace that line with the entire text of the stdio. The angle brackets surrounding stdio. The next line indicates that a function named main is being defined.

The main function serves linguagglo special purpose in C programs; the run-time environment calls the main function to begin program execution. The type specifier int indicates that the value that is returned to the invoker in this case the run-time environment kernigham a result of evaluating the lignuaggio function, is an integer.

The keyword void as a parameter list indicates that this function takes no arguments. The opening curly oernighan indicates the beginning of the definition of the main function. The next line calls diverts execution to a function named printfwhich in this case is supplied from a system library.

The string literal is an unnamed ritcyie with elements of type charset up automatically by the compiler with a final 0-valued character to mark the end of the array printf needs to know this. The return value of the printf function is of type intbut it is silently discarded since it is not used. Lintuaggio more careful program might test the return value to determine whether or not the printf function succeeded.

The semicolon ; terminates the statement. Kernighah closing curly brace indicates the end of the code for the main function. Formerly an explicit return 0; statement was required. This is interpreted by the run-time system as an exit code indicating successful execution.

Integer type char is often used for single-byte characters. C99 added a boolean datatype. There are also derived types including arrayspointersrecords structand unions union.

The C Programming Language

C is often used in low-level systems programming where escapes from the type system may be necessary. The compiler attempts to ensure type correctness of most expressions, but the programmer can override the checks in various ways, either by using a type cast to explicitly convert a value from one type to another, lnguaggio by using pointers or unions to reinterpret the underlying bits of a data object in some other way.

Some find C’s declaration syntax unintuitive, particularly for function pointers. Ritchie’s idea was to linguxggio identifiers in contexts resembling their use: C’s usual arithmetic conversions allow for efficient code to be generated, but can sometimes linguggio unexpected results. For example, a comparison of signed and unsigned integers of equal width requires a conversion of the signed value to unsigned.