C

From Gentoo Wiki
Jump to:navigation Jump to:search
This article is a stub. Please help out by expanding it - how to get started.
Not to be confused with the C++ programming language.
Not to be confused with the C# programming language.

C is a programming language developed for Bell Labs in the early 1970s. C is an imperative and procedural language that supports structured programming. It was designed to be portable across architectures instead of requiring the programmer to reimplement entire programs in the target architecture's native instruction set. At the time, this was accomplished either via a purpose-built assembler — typically supporting macros, comments and other convenient features — or by hand directly in machine language with a minimalist hex editor with no abstraction whatsoever.

This freed the programmer to think abstractly about solving the problem at hand while most of the underlying hardware specifics were abstracted away. From the perspective of scripting languages, such as BASIC, Perl, Raku, Python, or Java — all of which have virtual machines or interpreter runtimes — C is considered a low level language. Relative to assembly language, which abstracts individual CPU instructions into short human readable mnemonics, and Forth, which has "words" (subroutines) which may directly execute low-level CPU op-codes or directly manipulate the CPU's stack, C is a higher level language.

Developing in C on Gentoo

A very large percentage of open source software is written in C, most notably the Linux kernel. Gentoo has several C compilers, two of which are installed by default in the Gentoo base-build:

Other C compilers are available in Gentoo, many with specialized use cases:

Learning C today

There are a large number of free resources to help the novice programmer learn the C language. Stack Overflow has a list of C books and guides which its userbase considers definitive. Additional resources include:

See also

  • Assembly language — the lowest level of all programming languages, typically represented as a series of CPU architecture specific mnemonics and related operands.
  • Forth — a heavily stack-oriented self-compiling procedural programming language that is only slightly more abstract than assembly.
  • Modern C porting
  • Rust — a general-purpose, multi-paradigm, compiled, programming language.