C Language Fundamentals
The building blocks of every C program — standards, tokens, types, expressions and console I/O.
Read these in order if you are new to C. Program structure, the compilation process, data types and operators have their own pages earlier in this subject.
Sub-topics (19)
C Language Overview
A small, fast, portable systems language created by Dennis Ritchie at Bell Labs (1972) to write Unix.
C Standards (C89/C90 to C23)
The ISO versions of C and what each added.
Comments
Notes for humans that the compiler ignores.
Identifiers
Names for variables, functions and types.
Keywords
Reserved words with special meaning: `int`, `if`, `return`, `struct`, `static`, `volatile`, …
Literals
Fixed values written in source: integers, floats, characters and strings.
Variables
Named storage with a type.
Constants
Values that should not change: `const` variables, `#define` macros and `enum` constants.
Type Qualifiers
`const`, `volatile`, `restrict` and `_Atomic` add rules to a type.
Type Conversion
Implicit conversions between types and explicit casts.
Integer Promotions
Types smaller than `int` (char, short, bit-fields) are converted to `int` before arithmetic.
Operator Precedence
Which operators bind tighter: `*` before `+`, comparisons before `&&`, assignment last.
Expressions
Combinations of values, variables, operators and calls that produce a value.
Statements
Instructions: expression statements, blocks `{ }`, selection, loops, jumps and declarations.
Input and Output in C
Console I/O with the stdio library: formatted (`printf`/`scanf`) and character-by-character.
printf
Formatted output using conversion specifiers.
scanf
Formatted input — reads values into variables via pointers.
Character I/O
`getchar`, `putchar`, `getc`, `putc`, `fgetc`, `fputc` read and write single characters.
Escape Sequences
Backslash codes for special characters: `\n`, `\t`, `\\`, `\"`, `\0`, `\x41`.
Spotted a mistake or want to add detail? Suggest an improvement — Content Contributors' edits are reviewed by editors before they go live.
Discussion (0)
Sign in or join free to ask questions and discuss this topic.