Overview
C is a general-purpose high-level programming language originally designed by Dennis Ritchie at Bell Labs for developing the UNIX operating system. C was first implemented in 1972 on the DEC PDP-11 computer.
In 1978, Brian Kernighan and Dennis Ritchie published the first publicly available description of C, now known as the K&R standard.
UNIX, the C compiler, and most UNIX applications were written in C. For various reasons, C has become a widely used professional language.
Characteristics of C
- Easy to learn
- Structured language
- Produces highly efficient programs
- Can handle low-level operations
- Compilable on multiple computer platforms
About C
C was invented for writing the UNIX operating system.
C is based on the B language, which was introduced around 1970.
The C standard was established in 1988 by the American National Standards Institute (ANSI).
By 1973, the UNIX operating system was entirely implemented in C.
Today, C is one of the most widely used systems programming languages.
Many advanced software projects are implemented in C.
Popular software such as the Linux operating system and the MySQL relational database management system are implemented in C.
Why Use C?
C was originally used for system development tasks, particularly programs that make up an operating system. Because the code produced by C runs at speeds comparable to code written in assembly language, C was adopted as a systems development language. Typical use cases for C include:
- Operating systems
- Language compilers
- Assemblers
- Text editors
- Printer drivers
- Modern applications
- Databases
- Language interpreters
- Utilities
C Programs
A C program can be as short as three lines or as long as several million lines. Source files typically use the ".c" extension (for example, hello.c). You can write C source code using text editors such as vi or vim, or any other text editor.
This tutorial assumes you know how to edit a text file and write source code in a program file.
C11
C11 (also referred to as C1X) corresponds to the ISO standard ISO/IEC 9899:2011 and is the current C standard. The previous standard was C99.
New Features in C11
- Standardized alignment support (including the _Alignas specifier, alignof operator, aligned_alloc function, and related header).
- _Noreturn function specifier, similar to gcc's __attribute__((noreturn)).
- _Generic keyword.
- Multithreading support, including the _Thread_local storage-class specifier and headers providing thread creation and management functions.
- _Atomic type qualifiers and related header.
- Improved Unicode support. Based on the C Unicode Technical Report ISO/IEC TR 19769:2004, this includes char16_t and char32_t types for UTF-16/UTF-32 and headers for Unicode string conversion functions.
- Removal of gets() in favor of a safer alternative gets_s().
- Addition of bounds-checking function interfaces, defining safer functions such as fopen_s(), strcat_s(), and others.
- More floating-point handling macros.
- Support for anonymous structs and unions (previously available in gcc, standardized in C11).
- Static assertions via _Static_assert(), processed similarly to #if and #error.
- New fopen() mode "x" (exclusive creation), similar to POSIX O_CREAT|O_EXCL.
- Addition of quick_exit() as an alternative termination function that performs minimal cleanup when exit() is not appropriate.
ALLPCB
