C declarator explainer
Follow the binding of pointers, arrays, functions and qualifiers in a supported C11/C17 declaration.
About this tool
Enter one declaration and select Explain. Line breaks are allowed within that declaration; an ending semicolon is optional. Examples fill the input without evaluating it. Read the numbered steps from the declared name outward to the base type. The Tokens section shows the individual input tokens. Editing the input clears the previous explanation.
Without grouping parentheses, array and function suffixes bind before pointer prefixes. Thus int *a[3]; declares an array of three pointers to int, while int (*a)[3]; declares a pointer to an array of three int. int *(*fp)(void); declares a pointer to a function with no parameters returning a pointer to int.
The supported subset uses C11/C17 rules: built-in base types with valid signed, unsigned, short and long combinations; const and volatile on the base type or on individual pointers; nested parentheses; positive decimal array sizes without leading zeros; and function declarators. Parameter declarations may contain a base type, pointers and an optional name. Identifiers use ASCII letters, digits and underscores and cannot begin with a digit. Comments and preprocessor directives are outside this subset. Qualifiers belong to their own type level: const int *p; points to const int, whereas int *const p; makes the pointer itself const-qualified.
Under C11/C17, f() leaves the number and types of parameters unspecified. f(void) explicitly declares no parameters. This tool does not use the C23 meaning of empty parentheses. Arrays cannot have function or incomplete element types; functions cannot directly return arrays or functions. A pointer can connect these types, as in a function returning a pointer to an array.
Outside this subset: typedef names, structures, unions, enums, initializers, multiple declarations, storage-class specifiers, attributes, _Atomic, restrict, variable arguments, array or function parameters, variable-length arrays and array-size expressions. Unsupported syntax is not a claim that the declaration is invalid in all C programs. This is a declarator explainer, not a compiler or a check of an entire translation unit.
Input limits: 8192 characters, 512 tokens, nesting depth 64, 64 derived type layers, 64 parameters, identifiers up to 128 characters and array sizes up to 20 digits. Arrays are described symbolically; no storage is allocated or size in bytes calculated.
Sources: WG14 N1570, C11 draft, sections 6.7.2, 6.7.3 and 6.7.6; WG14 N3096, C23 draft, section 6.7.6.3, for the changed meaning of ().