C is an imperative, procedural language in the ALGOL tradition. It has a static type system. In C, all executable code is contained within subroutines (also called "functions", though not in the sense of functional programming). Function parameters are passed by value, although arrays are passed as pointers, i.e. the address of the first item in the array. Pass-by-reference is simulated in C by explicitly passing pointers to the thing being referenced.
C program source text is free-form code. Semicolons terminate statements, while curly braces are used to group statements into blocks.
The C language also exhibits the following characteristics:
- The language has a small, fixed number of keywords, including a full set of control flow primitives:
if/else
,for
,do/while
,while
, andswitch
. User-defined names are not distinguished from keywords by any kind of sigil. - It has a large number of arithmetic, bitwise, and logic operators:
+
,+=
,++
,&
,||
, etc. - More than one assignment may be performed in a single statement.
- 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-11. The original PDP-11 version of Unix was also developed in assembly language.[9]
Thompson wanted a programming language for developing utilities for the new platform. At first he tried to write a Fortran compiler, but he soon gave up the idea. Instead, he created a cut-down version of the recently developed systems programming language called BCPL. The official description of BCPL was not available at the time,[14] and Thompson modified the syntax to be less wordy and similar to a simplified ALGOL known as SMALGOL.[15] Thompson called the result B.[9] He described B as "BCPL semantics with a lot of SMALGOL syntax".[15] Like BCPL, B had a bootstrapping compiler to facilitate porting to new machines.[15] However, few utilities were ultimately written in B because it was too slow and could not take advantage of PDP-11 features such as byte addressability.
Comments
Post a Comment