C Programming
C is a general-purpose systems programming language that provides direct access to memory and hardware through pointers, manual allocation, and minimal runtime overhead. Most operating systems, embedded firmware, and performance-critical libraries are written in C.
itProgramming languages | OpenSkills.info
Course pathWalk it in order
Look it upDip in anytime
Go furtherLeaves this page
Don't Panic
Don't Panic — C Programming
C is a small language with an unusually large supply of responsibility. It lets a program describe data close to memory and platform interfaces, which is why it remains at home in operating systems, embedded software, runtimes, and libraries. The bargain is not mysterious: the language does not carry every guardrail that another language might install on your behalf.
Most of the course fits around three distinctions. A type says how a value may be interpreted and operated on. An object is the storage where that value lives. A pointer refers to an object or function, but does not arrive with an address label saying how many elements are valid, whether the object still exists, or who is responsible for releasing storage. It is a remarkably economical arrangement, rather like receiving a map with the roads but none of the bridges marked.
C programs pass through a preprocessor, compiler, and linker before they run. Headers make declarations available across translation units, while source files supply definitions. That division explains why an interface needs more than a parameter type. When a function receives a pointer, its useful contract also says whether null is allowed, how much storage is available, whether mutation is permitted, and how long the object lives.
The surprise is that an address that is non-null can still be wrong. An array expression often converts to a pointer to its first element, and that pointer does not retain the array's extent. Dynamic allocation adds another deadline: successful storage remains valid only until it is released. Undefined behavior is where the standard stops promising a result, so it is not a recoverable error code wearing a dramatic hat.
Start with the Intro when the language, implementation, and library layers need a proper map. The Slides compress their relationships into a sequence you can scan before writing code. Keep the Cheatsheet nearby for storage duration, behavior categories, and the five questions every pointer invites. Then use the Practice reference and exercise to make a build report what the source code would otherwise keep politely quiet about.
Where this skill leads
Relevant careers
See how this topic contributes to broader role-level skill maps.
Sources
- https://www.iso.org/standard/82075.html
Supports
- ISO/IEC 9899:2024 is edition 5 of the published C programming language standard
- The standard specifies C program representation, syntax, constraints, semantics, input and output representation, and implementation limits
- The standard promotes portability but does not prescribe transformation, invocation, or platform capacity mechanisms
- https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3096.pdf
Supports
- C defines arithmetic types and derived array, pointer, and function types
- A pointer value provides a reference to an entity of its referenced type
- Objects have static, thread, automatic, or allocated storage duration that determines lifetime
- Referring to an object outside its lifetime has undefined behavior
- Hosted program startup uses main, while freestanding startup is implementation-defined
- C strings are contiguous character sequences terminated by a null character, and string length excludes the terminator
- Undefined behavior imposes no requirements, with null-pointer dereference given as an example
- Function arguments initialize parameter objects from argument values
- The standard library defines headers and facilities including input and output, strings, and memory management
- https://gcc.gnu.org/onlinedocs/gcc/Standards.html
Supports
- GCC supports ISO C versions and corresponding standard-selection options
- GCC distinguishes ISO dialects from GNU dialects with extensions
- Hosted and freestanding implementations have different startup and library requirements
- https://gcc.gnu.org/onlinedocs/gcc/C-Dialect-Options.html
Supports
- The standard option selects the accepted C language dialect
- Pedantic diagnostics identify extensions relative to the selected base standard
- https://sourceware.org/glibc/manual/latest/html_mono/libc.html
Supports
- The C language relies on library facilities for common input and output, memory management, and string operations
- The GNU C Library manual documents allocation, streams, strings, processes, time, and system-facing facilities
- https://clang.llvm.org/docs/AddressSanitizer.html
Supports
- AddressSanitizer combines compiler instrumentation and a runtime library
- It can detect out-of-bounds accesses, use after free, double free, invalid free, and other memory errors during execution
- Clang enables it with the address sanitizer compiler option
- https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html
Supports
- UndefinedBehaviorSanitizer detects several undefined operations during instrumented execution
- Checks include invalid array bounds, null or misaligned pointer use, invalid shifts, division by zero, and signed integer overflow
- https://cmu-sei.github.io/secure-coding-standards/sei-cert-c-coding-standard/front-matter/introduction/
Supports
- The SEI CERT C Coding Standard provides rules for safe, reliable, and secure C systems
- Its guidance targets undefined behavior that can contribute to exploitable vulnerabilities
- Conformance to its rules is necessary but not sufficient for safety, reliability, and security
- https://open-std.org/jtc1/sc22/wg14/www/docs/n3280.htm
Supports
- The C Committee identifies the 1978 book The C Programming Language by Kernighan and Ritchie as C's first description
- https://www9.open-std.org/JTC1/SC22/WG14/www/projects.html
Supports
- WG14 lists C89 as ANSI X3.159-1989 and C90 as ISO/IEC 9899:1990
- WG14 lists C95 as ISO/IEC 9899:1990 Amendment 1 from 1995
- WG14 lists C99, C11, C17, and C23 as ISO/IEC 9899 revisions published in 1999, 2011, 2018, and 2024
- https://www.gnu.org/software/gcc/
Supports
- GCC includes a front end for the C programming language
- https://clang.llvm.org/
Supports
- Clang is a C language family front end for LLVM
- Clang uses the LLVM Apache 2 License
- https://www.microsoft.com/licensing/guidance/Visual-Studio
Supports
- Visual Studio offers purchasable standalone perpetual licenses and a Community edition for users who meet its license requirements
- https://www.iar.com/embedded-development-tools/iar-embedded-workbench
Supports
- IAR Embedded Workbench packages an optimized compiler, debugger, and analysis tools for embedded targets
- IAR provides an IAR C/C++ Compiler for supported microcontroller and processor architectures
- https://developer.arm.com/Tools%20and%20Software/Keil%20MDK
Supports
- Arm Keil MDK includes Arm Compiler for Embedded, assembler, linker, optimized runtime libraries, and debugging tooling for Arm-based microcontrollers
- Keil MDK uses user-based licensing
- https://www.keil.arm.com/mdk-community/
Supports
- Keil MDK Community Edition is free for non-commercial projects
- https://blog.regehr.org/archives/213
Supports
- C and C++ compilers need consider only executions whose behavior is defined
- Avoiding bounds checks and assuming signed overflow does not occur can enable loop optimization
- https://developers.redhat.com/blog/2021/05/05/memory-error-checking-in-c-and-c-comparing-sanitizers-and-valgrind
Supports
- Sanitizers require compilation with instrumentation and have runtime overhead
- AddressSanitizer and UndefinedBehaviorSanitizer can be enabled together in an instrumented build
- Sanitizers detect selected classes of errors during execution
- https://blog.regehr.org/archives/26
Supports
- C and C++ programs can change behavior when compiler optimization options change
- Undefined behavior can be exploited by compiler optimizations
