C syntax
The syntax of the C programming language is the set of lexical rules, grammar productions, and constraints that define how C source code is written and how a conforming compiler must read it. It is specified normatively in ISO/IEC 9899, the international C standard, whose language clause presents the grammar in a notation adapted from the C Reference Manual written by the language's creator, Dennis Ritchie1. The standard is maintained by ISO/IEC JTC1/SC22/WG14, the international standardization working group for C2, and the current edition is C23, ISO/IEC 9899:2024, adopted by ISO and IEC in 20242.
| Key fact | Detail |
|---|---|
| Steward | ISO/IEC JTC1/SC22/WG14, the working group for the programming language C2 |
| Current edition | C23, ISO/IEC 9899:2024, adopted in 2024; the next edition, C2y, is in development2 • 3 |
| Revision history | C89 (ANSI X3.159-1989), C90, C95, C99, C11, C17, C233 |
| Not a context-free language | The meaning of an identifier depends on whether it has been declared as a typedef name, so parsers must consult a live typedef table while parsing4 |
| C23 keywords | alignas, alignof, bool, false, static_assert, thread_local, true become keywords5 |
| C23 removals | Old-style function definitions with identifier lists and unprototyped declarations are removed5 |
| Translation phases | Line splicing, tokenization with comment removal, and macro expansion occur in a specified order before semantic analysis6 |
| Compiler support | GCC supports ISO C23 via the -std=c23 and -std=gnu23 options added in GCC 14, and C23 mode is the default since GCC 155 |
The standard's description of the syntax
The C standard specifies the form and interpretation of C programs: the representation of C programs, the syntax and constraints of the language, the semantic rules for interpreting them, and the restrictions and limits a conforming implementation must impose6. Its purpose is stated as promoting the portability, reliability, maintainability, and efficient execution of C programs across computing systems7.
The standard treats translation as a sequence of phases: physical source lines are mapped to the source character set and spliced where a backslash ends a line; the file is decomposed into preprocessing tokens and white space, with each comment replaced by a space; preprocessing directives are executed and macro invocations are expanded; and only then is the token sequence processed as C6. The standard is designed for implementors and knowledgeable programmers, and it explicitly states that it is not a tutorial7.
The standard also classifies behavior the syntax does not pin down. Undefined behavior covers erroneous constructs on which the standard imposes no requirements, such as integer overflow; unspecified behavior covers cases where two or more outcomes are allowed, such as the evaluation order of function arguments; implementation-defined behavior covers choices an implementation must document, such as the propagation of the high-order bit when a signed integer is shifted right6.
Grammar and parsing
C's grammar is presented as productions in the standard, but the language it describes is not context-free. The decisive case is the typedef: whether an identifier names a type or an ordinary value depends on prior declarations in the translation unit, so a parser must consult a live typedef table as it reads, something awkward to express in a purely declarative grammar file4. A ( token can begin a cast expression, a compound literal, a parenthesized expression, or a parenthesized declarator, and hand-written parsers resolve these cases with speculative parsing, trying one interpretation and backtracking on failure4.
Operator precedence is a practical consequence of the grammar. The GNU C Language Manual lists a usable subsequence of the precedence ordering, from highest to lowest: postfix operations (field access with . and ->, array subscripting, function calls), unary prefix operations, multiplication, division, and remainder, addition and subtraction, comparisons, the logical operators && and ||, the conditional expression, assignments, and the comma operator8. It advises that when two comparison operations are used together, or when && and || are combined, parentheses should make the nesting explicit rather than relying on the grammar's fine distinctions8. The same manual notes that && guarantees to skip its right operand when the left one is false, which is why an expression such as r != 0 && x % r == 0 never divides by zero8.
Dennis Ritchie, who developed C at Bell Labs in the early 1970s, later characterized the language as "quirky, flawed, and an enormous success", citing its strange syntax and confusing declarations among the quirks9.
How the syntax reached its present form
The original language was developed by Ritchie between 1971 and 1973, and it became widely known through The C Programming Language by Brian Kernighan and Dennis Ritchie, published in 1978; the pre-standard version is called K&R C10. By the early 1980s usage was widespread enough to merit formal standardization: ANSI established the X3J11 committee in 1983, the standard X3.159-1989 was produced in 1989, and ISO ratified it the following year as ISO/IEC 9899:199010. A 1995 amendment added support for international character sets but did not change the grammar10.
Standardization changed the declaration syntax. The ANSI process augmented the syntax for parameter declarations to include the prototype style used in C++, while continuing to permit the older K&R interface11.
WG14 has produced the revision sequence C90, C95, C99, C11, C17, and C23, with C2y under development and no publication yet available3. The committee also processes change and clarification requests, previously called defect reports, against each published edition of the standard3. The informal name of the current edition was itself settled by committee: WG14 took a vote to make the nickname "C23" official, preferring it to "C24"12.
Changes in C23
C23, published as ISO/IEC 9899:2024, made visible changes to the syntax programmers write2. The words alignas, alignof, bool, false, static_assert, thread_local, and true become keywords in their own right rather than macros from headers5 • 13. The predefined macro __STDC_VERSION__ is bumped to 202311L13.
C23 also removes long-standing syntax: function definitions with identifier lists, the old K&R style, and function declarations whose parameter list is empty, which are now treated the same as a parameter list containing only void5. cppreference's C23 page lists further removals: representations for signed integers other than two's complement, mixed wide string literal concatenation, and support for calling realloc() with zero size, whose behavior becomes undefined13.
Support arrived quickly in major compilers. GCC added the new keywords in version 13, removed old-style function definitions in version 10, and introduced the -std=c23 and -std=gnu23 command-line options in GCC 14; since GCC 15, C23 mode is the default5 • 14.
Grammar work in progress
The grammar continues to be a topic of committee proposals even between editions. A 2024 proposal for C2y introduced an elementsof operator to give array-element counts alongside sizeof, noting that "C23 seems to have shifted away from uglified keywords" and defaulting to the plain keyword name directly15. The C23 charter itself framed the revision around influences including the evolution of C-like languages such as C++, Java, and C#, the rising security threat on the Internet, and increased awareness of programming language vulnerabilities16.
References
- WG14 N3088, C standard draft, Introduction note on Clause 6
- ISO/IEC JTC1/SC22/WG14 homepage
- WG14 Project status and milestones
- claudes-c-compiler, parser README, typedef and ambiguity notes
- C Standards Support in GCC, GNU Project
- WG14 N843, C99 Committee Draft, clauses 1, 3, 4, 5
- ISO/IEC 9899:2024, N3220 working draft, Abstract and Scope
- GNU C Language Manual, Logical Operators and Comparisons
- TechRadar Pro, Ritchie quote of the day on C's quirks
- Royal Holloway grammars project, C language history and grammars
- History of C Programming, courseware PDF
- WG14 N3372, proposal on official standard titles
- C23, cppreference.com
- GCC 14 Release Series changes
- WG14 N3313, Proposal for C2y: elementsof
- WG 14 N 2611, C23 Charter
Topic: Encyclopedia › Society and history › Languages and linguistics › Linguistics › Formal and computational linguistics › Concrete syntax of programming and query languages
Initially written Sep 17, 2026 · Reviewed: Sep 30, 2026; Oct 25, 2026 · Edited: Sep 30, 2026; Oct 25, 2026 · Last review: Oct 25, 2026
Your notes
© 2026 EdgeChat AI, a subsidiary of Biostate AI. Free to use with credit under the Edgepedia Community License. Developers: read Edgepedia by API or MCP. Embed a reference card.