The Microsoft C compiler (MSVC) implements the C programming language as defined by the ISO/IEC standards, with additional Microsoft-specific extensions. The C Language Reference in this documentation describes the C language as it exists in Visual Studio, and is organized after the ANSI C standard (C89/C90) while adding coverage of C99, C11, and C17 features that MSVC has adopted over time. Understanding which standard is in effect for your project is the first step toward writing portable, conformant C code.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/MicrosoftDocs/cpp-docs/llms.txt
Use this file to discover all available pages before exploring further.
ANSI/ISO Conformance
Microsoft C conforms to the standard for the C language as set forth in the 9899:1990 edition of the ANSI C standard (commonly called C89 or C90). Microsoft extensions to the ANSI C standard are noted throughout this reference. Because extensions are not part of the ANSI C standard, their use may restrict portability between systems. By default, Microsoft extensions are enabled. To disable them and compile in strict ANSI mode, use the/Za compiler option. With /Za, all non-ANSI code generates errors or warnings. To re-enable extensions explicitly, use /Ze (the default behavior).
Using
/Za disables many convenient Microsoft-specific features. For most Windows application code, leaving extensions enabled (the default /Ze behavior) is recommended. For maximum portability, target a specific ISO standard using /std:c11 or /std:c17 rather than relying on /Za.C11 and C17 Support
Visual Studio 2019 version 16.8 introduced support for C11 (/std:c11) and C17 (/std:c17) language standards. The conformant preprocessor (/Zc:preprocessor) is automatically enabled when either of these modes is selected.
- /std:c11
- /std:c17
Enables C11 conformance. The macro
__STDC_VERSION__ expands to 201112L. Key C11 features include:_Static_assertfor compile-time assertions- Anonymous structs and unions
_Noreturnfunction specifier_Alignas/_Alignofalignment specifiers_Generictype-generic expressions
Optional C11/C17 Features Not Supported
MSVC defines several__STDC_NO_* macros to indicate omitted optional library components when compiling under C11 or C17:
| Macro | Meaning |
|---|---|
__STDC_NO_ATOMICS__ | Atomic operations (<stdatomic.h>) not supported |
__STDC_NO_COMPLEX__ | Complex arithmetic (<complex.h>) not supported |
__STDC_NO_THREADS__ | Standard threads (<threads.h>) not supported |
__STDC_NO_VLA__ | Variable-length arrays not supported |
Microsoft-Specific Extensions
Even in standard modes, MSVC provides many extensions over and above what ISO C requires. These include:- Microsoft-specific calling conventions:
__cdecl,__stdcall,__fastcall,__vectorcall - Structured Exception Handling (SEH) with
__try,__except,__finally - Compiler intrinsics for direct hardware access
__declspecmodifiers for DLL import/export, alignment, deprecated annotations, and more- The
__pragmakeyword for embedding pragmas in macro definitions
Topics Covered in This Reference
This C Language Reference is organized into the following major sections:Elements of C
Elements of C
Covers the fundamental lexical building blocks of C programs — tokens, keywords, identifiers, constants, string literals, operators, and punctuation. This section explains how the MSVC compiler tokenizes source text and evaluates lexical elements in accordance with ANSI C syntax.
Declarations and Types
Declarations and Types
Covers the full type system: fundamental types (
int, char, float, double, _Bool), type specifiers, type qualifiers (const, volatile, restrict), storage-class specifiers (auto, extern, static, register), struct and union declarations, enumeration types, typedef declarations, and extended MSVC storage-class attributes.Expressions and Operators
Expressions and Operators
Covers all C operators, their precedence and associativity, usual arithmetic conversions, implicit type conversions, assignment operators, compound assignment, and constant expressions.
Statements
Statements
Covers expression statements, compound statements (blocks), selection statements (
if, switch), iteration statements (for, while, do-while), jump statements (break, continue, return, goto), and labeled statements.Functions
Functions
Covers function declarations, definitions, calling conventions, inline functions, variadic functions (
va_list, va_start, va_arg, va_end), DLL import/export functions, and function pointers.C Language Reference Appendices
C Language Reference Appendices
Includes reference tables for ASCII character sets, trigraphs, escape sequences, integer limits, floating-point limits, and operator precedence.
See Also
- C++ Language Reference — Microsoft’s C++ implementation
- Preprocessor Reference — Preprocessor directives, macros, and pragmas
- C/C++ Building Reference — Compiler and linker options