cdecl+
C Declarations & printf/scanf ➔ Prose
Examples:
- char const * const
- int x; float y;
- int(*(*)[10])()
- typedef struct s {} s, *sptr
- int(*(*arr)[10])()
- void &(int[*]) _Atomic [0]
- fprintf(stderr, "%#*.*LF", width, precision, number)
- scanf("%4d/%2d/%2d", &year, &month, &day)
Return type may not be an array
Return type may not be a function
Can not create atomic array
Can not create atomic function
Can not create array of references
Can not create array of functions
Can not create array of void, which is an incomplete type
Can not create reference to void
Can not create reference to member
Can not declare variable/parameter of type void
Void as parameter must not have type qualifiers
Can not create pointer to reference
Arrays with type qualifiers may only appear in function parameters
VLA of unspecified size may only appear in function parameters
Functions may not be _Atomic-qualified
Functions may not be restrict-qualified
Duplicate qualifier on pointer
Duplicate qualifier on function
Zero-size arrays are a non-standard extension
Type is implicitly int
Implicit double type for complex specifier is non-standard
Parameter of array type decays to pointer
Parameter of function type decays to pointer to function
Function with empty parameter list takes unspecified number of parameters
constexpr adds an implicit const in this case
The given format string is invalid. This results in undefined behaviour.
Not enough arguments were provided for the given format string.
Too many arguments were provided for the given format string.
%% can not accept any flags, width, precision, or length modifier
%% can not have assignment suppression, width, or length modifier
%s or %[] with no width may lead to buffer overflow like
gets
literals do not consume leading whitespace,
which may be a pitfall here
%c and %[] do not consume leading whitespace,
which may be a pitfall here
Use of max field width AND receiving buffer size in _s functions is redundant
Bounds-checked functions (_s) are optional (check #if __STDC_LIB_EXT1__ == 1)
printf outputs to
stdout
fprintf outputs to the given
file
sprintf outputs to the given buffer (char*)
sprintf outputs to the given buffer (char*) and size (size_t)
fprintf_s outputs to the given
file
sprintf_s outputs to the given buffer (char*) and size (rsize_t)
sprintf_s outputs to the given buffer (char*) and size (rsize_t)
scanf reads from
stdin
fscanf reads from the given
file
sscanf reads from the given null-terminated string (const char*)
scanf_s reads from
stdin
fscanf_s reads from the given
file
sscanf_s reads from the given null-terminated string (const char*)
For more info, see
printf documentation
For more info, see
scanf documentation