ArticleslgStudy

computer science

C (programming language)

C (programming language) is a computer science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand C (programming language) rather than just read about it. In short: C is a general-purpose programming language created in 1972 by Dennis Ritchie. By design, C gives programmers relatively direct access to the features of typical CPU architectures, customized for the target instruction set.

C (programming language) — main illustration
C (programming language) — illustration

Key takeaways

  • C (programming language) belongs to computer science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect C (programming language) to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of C (programming language) from memory before moving on to harder problems.

Reference excerpt

C is a general-purpose programming language created in 1972 by Dennis Ritchie. By design, C gives programmers relatively direct access to the features of typical CPU architectures, customized for the target instruction set. It has been and continues to be used to implement operating systems (especially kernels), device drivers, and protocol stacks, though its use in application software is decreasing. C is used on computers ranging from supercomputers to microcontrollers and embedded systems. C was initially developed as a successor to the B programming language at Bell Labs by Ritchie between 1972 and 1973. Its initial purpose was to construct utilities running on Unix, and was later applied to re-implementing the kernel of the Unix operating system. During the 1980s, C gradually gained popularity, leading to it becoming one of the most widely used programming languages, with C compilers available for practically all modern computer architectures and operating systems. The book The C Programming Language, co-authored by the original language designer, served for many years as the de facto standard for the language. C has been standardized since 1989 by the American National Standards Institute (ANSI) and, subsequently, jointly by the International Organization for Standardization (ISO) and the International Electrotechnical Commission (IEC). C is an imperative procedural language, supporting structured programming, lexical variable scope, and recursion, with a static type system. It was designed to be compiled to provide low-level access to memory and language constructs that map efficiently to machine instructions, all with minimal runtime support. Despite its low-level capabilities, the language was designed to encourage cross-platform programming. A standards-compliant C program written with portability in mind can be compiled for a wide variety of computer platforms and operating systems with few changes to its source code. Although neither C nor its standard library provide some popular features found in other languages, it is flexible enough to support them. For example, object orientation and garbage collection are provided by external libraries GLib Object System and Boehm garbage collector, respectively. Since 2000, C has typically ranked as the most or second-most popular language in the TIOBE index.

Characteristics

C is an imperative, procedural language with a free-form source layout. Statements are terminated by semicolons and grouped into blocks using curly braces. All executable code is contained in functions rather than top-level statements. The language has a relatively small number of keywords, and user-defined identifiers are not distinguished from keywords by any sigil. Parameters are passed by value; pass-by-reference is achieved with pointers. A function's return value may be ignored, and while a function cannot normally be nested inside another function, some translators support this. C supports recursion, and run-time polymorphism may be achieved using function pointers. Control flow is provided through constructs such as if, for, do, while, and switch. The language offers arithmetic; bitwise; and logical operators including +, +=, ++, &, ||, and multiple assignments may be performed in a single statement. A variable declared inside a block is accessible only within that block and only below its declaration. Data typing is weakly enforced and static, with implicit conversion between primitive types. User-defined types allow aliasing of type specifiers. Arrays are defined and accessed with square-bracket notation, for example v[3]. User-defined structure types let related data elements be passed and copied as a unit, though two structures cannot be compared without custom code to compare each field. Unions support overlapping members, allowing multiple data types to share the same memory location, and enumeration types support aliasing integer values. C lacks a dedicated string type but provides syntax for null-terminated strings, with associated handling in its standard library. The language supports low-level access to computer memory via pointers, procedure-like constructs in the form of functions returning void, and dynamic memory allocation through standard library functions. It includes the C preprocessor for macro definition, source-file inclusion, and conditional compilation. Modularity is supported by processing files separately, with visibility controlled through the static and extern attributes. Functionality is minimized in the core language, with relatively complex features such as I/O, string manipulation, and mathematical functions being provided through standard libraries. The resulting compiled code has relatively straightforward requirements of the underlying platform, making C desirable for operating and embedded systems.

"Hello, world" example

The "Hello, World!" program example that appeared in the first edition of K&R has become the model for an introductory program in most programming textbooks. The program prints "hello, world" to the standard output. The original version was:

A more modern version is:

… excerpt ends here. Continue reading the full article.

Illustrations

C (programming language) illustration
C (programming language): Dennis Ritchie (right), the inventor of the C programming language, with Ken Thompson
Dennis Ritchie (right), the inventor of the C programming language, with Ken Thompson
C (programming language): "Hello, World" program by Brian Kernighan (1978)
"Hello, World" program by Brian Kernighan (1978)
C (programming language): The cover of the book The C Programming Language, first edition, by Brian Kernighan and Dennis Ritchie
The cover of the book The C Programming Language, first edition, by Brian Kernighan and Dennis Ritchie
C (programming language) illustration

Worked examples

Example 1 — a first encounter with C (programming language)

Start with the simplest possible case. Write down what C (programming language) claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In computer science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to C (programming language) before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about C (programming language) ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of C (programming language)

In research
C (programming language) appears in computer science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses C (programming language) in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
C (programming language) is common in secondary-school and first-year university syllabi. It links to neighbouring topics American inventions, C (programming language), C (programming language) libraries, so understanding it makes those chapters shorter.
In everyday life
Look for C (programming language) outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “C (programming language)” →

How to study C (programming language) in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what C (programming language) means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain C (programming language) out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is C (programming language) in simple terms?

C is a general-purpose programming language created in 1972 by Dennis Ritchie. By design, C gives programmers relatively direct access to the features of typical CPU architectures, customized for the target instruction set.

Why does C (programming language) matter?

Because it connects several computer science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study C (programming language)?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on C (programming language).

Tags

  • American inventions
  • C (programming language)
  • C (programming language) libraries
  • C programming language family
  • Compiled programming languages
  • Cross-platform software
  • Free software programmed in C
  • High-level programming languages
  • Lists of software
  • Mathematical libraries
  • Procedural programming languages
  • Programming languages

Keep exploring