C
Published:
C is the low-level, general-purpose, imperative computer programming language most used in computer science and computer engineering. C supports structured programming, lexical variable scope and recursion, while a static type system prevents many unintended operations. By design, C provides constructs that map efficiently to typical machine instructions, and therefore it has found lasting use in applications that had formerly been coded in assembly language, including operating systems, as well as various application software for computers ranging from supercomputers to embedded systems.
It was developed by Dennis Ritchie between 1969 and 1973 at Bell Labs, and used to re-implement the Unix operating system. The main dialects of C are Cyclone, Unified Parallel C, Split-C, Cilk, C’*’. It has derived programming languages as C++, C–, C#, Objective-C.
As an imperative (procedural) language, C was designed to be compiled easy, and provides low-level access to memory, language constructs that map efficiently to machine instructions, and to require minimal run-time support. Despite its low-level capabilities, the language was designed to encourage cross-platform programming. A standards-compliant and portably written C program 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.
The main features are:
- Minimal but essential flow of control instructional: for, if/else, while, switch, and do/while
- Large number of arithmetical and logical operators.
- Low-level access to computer memory is possible by converting machine addresses to typed pointers.
- Huge community and a lot of tools to communicate with other systems and languages.
It is recommended for:
- Projects with high-performance needs.
- Projects with low-level flexibility needs.
Syntax
It provides three distinct ways to allocate memory for objects:
- Static memory allocation: space for the object is provided in the binary at compile-time; these objects have an extent (or lifetime) as long as the binary which contains them is loaded into memory.
- Automatic memory allocation: temporary objects can be stored on the stack, and this space is automatically freed and reusable after the block in which they are declared is exited.
- Dynamic memory allocation: blocks of memory of arbitrary size can be requested at run-time using library functions such as malloc from a region of memory called the heap; these blocks persist until subsequently freed for reuse by calling the library function realloc or free.
See also
Python, Julia, SAS, Matlab, Go (Programming language), Java, R, Fortran
Material
- https://en.wikibooks.org/wiki/C_Programming
Books
- Kernighan, Brian W.; Ritchie, Dennis M. (1988). C Programming Language 2nd Edition. Pearson Education Pte. Ltd.
- Prinz, Peter; Crawford, Tony (2005). C in a Nutshell. O’Reilly Media
- King, K. N. (2008). C Programming: A Modern Approach. W. W. Norton & Company
- Kochan, Stephen G. (2004). Programming in C. 3rd Edition, Sams Publishing
- Perry, Greg. (1994). Absolute Beginner’s Guide to C. 2nd Edition, Sams Publishing
- Prata, Stephen. (2004). C Primer Plus. 5th Edition, Sams Publishing
- van der Linden, Peter. (1994) Expert C Programming: Deep C Secrets. Prentice Hall
- Sedgewick, Robert (1997). Algorithms in C, Parts 1-4: Fundamentals, Data Structures, Sorting, Searching. 3rd Edition, Addison-Wesley Professional.