C Programming Language
Essay by review • December 20, 2010 • Research Paper • 5,718 Words (23 Pages) • 2,546 Views
The C programming language (often, just "C") is a general-purpose, procedural, imperative computer programming language developed in the early 1970s by Dennis Ritchie for use on the Unix operating system. It has since spread to many other operating systems, and is now one of the most widely used programming languages. C also has had a great influence on many other popular languages,[1] especially [[C++]] which was originally designed as an enhancement to C. It is the most commonly used programming language for writing system software,[2][3] though it is also widely used for writing applications. Though not originally designed as a language for teaching, and despite its somewhat unforgiving character, C is commonly used in computer science education, in part because the language is so pervasive.
Philosophy
C is a minimalistic programming language. Among its design goals were that it could be compiled in a straightforward manner using a relatively simple compiler, provide low-level access to memory, generate only a few machine language instructions for each of its core language elements, and not require extensive run-time support. As a result, C code is suitable for many systems-programming applications that had traditionally been implemented 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.
Characteristics
As an Algol-based language, C has the following characteristics:
A procedural programming paradigm, with facilities for structured programming
Lexical variable scope and recursion
A static type system which prevents many meaningless operations
Function parameters are generally passed by value (pass-by-reference is achieved in C by explicitly passing pointer values)
Heterogeneous aggregate data types (struct in C) which allow related data elements to be combined and manipulated as a unit
A small set (around 30) of reserved keywords
C also has the following specific properties:
Weak typing -- for instance, characters can be used as integers (similar to assembly)
Low-level access to computer memory via machine addresses and typed pointers
Function pointers allow for a rudimentary form of closures and runtime polymorphism
Array indexing as a secondary notion, defined in terms of pointer arithmetic
A standardized C preprocessor for macro definition, source code file inclusion, conditional compilation, etc.
A simple, small core language, with functionality such as mathematical functions and file handling provided by library routines
C discarded the well established logical connectives and and or of most other algol derivatives and replaced them with && and ||, which
Were invented in order to make bit-wise operations (& and |) syntactically distinct -- C's predecessor B used & and | for both meanings
Never evaluate the right operand if the result can be determined from the left alone
C popularized the controversial decision to free the equal-sign for assignment use by replacing = with == (inherited from B).
C lacks features found in some other systems implementation languages:
No non-scalar operations such as copying of arrays or strings (old versions of C did not even copy structs automatically)
No automatic garbage collection
No bounds checking of arrays
No semi-dynamic (i.e. stacked, runtime-sized) arrays until the C99 standard (despite not requiring garbage collection)
No syntax for ranges, such as the A..B notation used in both newer and older languages
No nested function definitions (although some compilers provide them, for example, GCC)
No formal closures or functions as parameters (only function and variable pointers)
No generators or coroutines; intra-thread control flow consists of nested function calls, except for the use of the longjmp or setcontext library functions
No exception handling; standard library functions signify error conditions with the global errno variable and/or special return values
Rudimentary support for modular programming
No compile-time polymorphism in the form of function or operator overloading; only rudimentary support for generic programming
No support for object-oriented programming; in particular, no support for polymorphism, inheritance and limited (inter-module only) support for encapsulation, even though there are libraries offering object systems for C, and many object-oriented languages are themselves written in C
No native support for multithreading and networking, though these facilities are provided by popular libraries
No standard libraries for graphics and several other application programming needs
Although the list of built-in features C lacks is long, this has contributed significantly to its acceptance, as new C compilers can be developed quickly for new platforms. The relatively low-level nature of the language affords the programmer close control over what the program is doing, while allowing solutions that can be specially tailored and aggressively optimized for a particular platform. This allows the code to run efficiently on very limited hardware, such as mass-produced consumer embedded systems, which today are as capable as the general-purpose machines originally used to implement C.
A number of the above missing features are available through the use of third
...
...