> ## Documentation Index
> Fetch the complete documentation index at: https://docs.syntblaze.com/llms.txt
> Use this file to discover all available pages before exploring further.

# C Predefined Macros

Predefined macros are identifier constants automatically defined by the C preprocessor prior to the compilation phase. They provide metadata about the compilation environment, the current source file, and compiler compliance. The preprocessor substitutes these identifiers with specific string literals or integer constants during translation phase 4.

By ISO C standard mandate, these macros are reserved. They cannot be undefined using `#undef` or redefined using `#define`.

## Standard Predefined Macros (C89/C90)

The following macros are universally supported by any standard-compliant C compiler:

* `__FILE__`: Expands to a character string literal representing the presumed name of the current source file.
* `__LINE__`: Expands to a decimal integer constant representing the presumed current line number within the current source file.
* `__DATE__`: Expands to a character string literal representing the date of translation. The format is `"Mmm dd yyyy"` (e.g., `"Jan 01 2024"`). If the day is less than 10, the first character of `dd` is a space.
* `__TIME__`: Expands to a character string literal representing the time of translation. The format is `"hh:mm:ss"`.
* `__STDC__`: Expands to the integer constant `1` if the compiler implementation conforms to the ISO C standard.

## Extended Standard Macros (C99 and Later)

Subsequent revisions of the C standard introduced additional predefined macros to expose environment and version details:

* `__STDC_VERSION__`: Expands to a `long` integer constant indicating the specific ISO C standard version the compiler adheres to.
  * `199409L` (C89 amendment 1)
  * `199901L` (C99)
  * `201112L` (C11)
  * `201710L` (C18)
* `__STDC_HOSTED__`: Expands to the integer constant `1` if the implementation is a hosted environment (has the full standard library available), or `0` if it is a freestanding environment.

## Syntax and Expansion Visualization

```c theme={"dark"}
#include <stdio.h>

int main(void) {
    /* String literal expansions */
    const char* current_file = __FILE__;
    const char* compile_date = __DATE__;
    const char* compile_time = __TIME__;

    /* Integer constant expansions */
    int current_line         = __LINE__;
    int is_standard_c        = __STDC__;
    long c_version           = __STDC_VERSION__;
    int is_hosted            = __STDC_HOSTED__;

    return 0;
}
```

## The `#line` Directive Interaction

While predefined macros cannot be redefined via `#define`, the preprocessor's internal state for `__LINE__` and `__FILE__` can be explicitly mutated using the `#line` directive.

```c theme={"dark"}
#line 100 "virtual_file.c"
/* On the next line, __LINE__ expands to 100 and __FILE__ expands to "virtual_file.c" */
```

## Note on `__func__`

Introduced in C99, `__func__` is frequently associated with predefined macros, but it is technically a **predefined identifier**, not a preprocessor macro. It is evaluated by the compiler, not the preprocessor. It behaves as if the following declaration were implicitly made immediately after the opening brace of a function:

```c theme={"dark"}
static const char __func__[] = "function_name";
```

<div
  style={{ 
display: "flex", 
justifyContent: "space-between", 
alignItems: "center", 
maxWidth: "754px", 
padding: "1rem 0",
marginBottom: "24px"
}}
>
  <span style={{ fontWeight: "bold", fontSize: "1.25rem", color: "var(--tw-prose-headings)", fontFamily: "Inter, ui-sans-serif, system-ui, sans-serif" }}>Tired of Poor C Skills? Fix That With Deep Grasping!</span>

  <a
    href="https://syntblaze.com"
    target="_blank"
    style={{ 
  marginLeft: "24px",
  textDecoration: "none", 
  backgroundColor: "#007AFF",
  color: "#ffffff", 
  padding: "6px 16px", 
  borderRadius: "16px",
  fontSize: "0.9rem",
  fontWeight: "600",
  textAlign: "center",
  transition: "background-color 0.2s ease"
}}
  >
    Learn More
  </a>
</div>

<div style={{ display: "flex", gap: "12px", flexWrap: "wrap" }}>
  <img src="https://mintcdn.com/syntblazellc/-L0ums_2lctDSZ1l/images/skill-tracking.png?fit=max&auto=format&n=-L0ums_2lctDSZ1l&q=85&s=b9b0305c93bb501c9e767b5c76c88835" style={{ width: "30%", minWidth: 60 }} width="621" height="1344" data-path="images/skill-tracking.png" />

  <img src="https://mintcdn.com/syntblazellc/23tyuOzaWS88qFlc/images/nuggets.png?fit=max&auto=format&n=23tyuOzaWS88qFlc&q=85&s=c86c80197299762989e9b882419b2109" style={{ width: "30%", minWidth: 60 }} width="621" height="1344" data-path="images/nuggets.png" />

  <img src="https://mintcdn.com/syntblazellc/-L0ums_2lctDSZ1l/images/bite-sized-exercises.png?fit=max&auto=format&n=-L0ums_2lctDSZ1l&q=85&s=a65f9a38c37ff28ab73ed783c53c60e3" style={{ width: "30%", minWidth: 60 }} width="621" height="1344" data-path="images/bite-sized-exercises.png" />
</div>

<div style={{ display: "flex", gap: "12px", flexWrap: "wrap", marginTop: "12px" }}>
  <img src="https://mintcdn.com/syntblazellc/-L0ums_2lctDSZ1l/images/mastery-chain.png?fit=max&auto=format&n=-L0ums_2lctDSZ1l&q=85&s=748a1763454713e679260fbb95f154a2" style={{ width: "30%", minWidth: 60 }} width="621" height="1344" data-path="images/mastery-chain.png" />

  <img src="https://mintcdn.com/syntblazellc/-L0ums_2lctDSZ1l/images/element-previews.png?fit=max&auto=format&n=-L0ums_2lctDSZ1l&q=85&s=242f61448ff5dd6deaaab2dccc13b507" style={{ width: "30%", minWidth: 60 }} width="621" height="1344" data-path="images/element-previews.png" />

  <img src="https://mintcdn.com/syntblazellc/-L0ums_2lctDSZ1l/images/element-explanations.png?fit=max&auto=format&n=-L0ums_2lctDSZ1l&q=85&s=cf0fc1c31f9cd0fc26716781be05fbc9" style={{ width: "30%", minWidth: 60 }} width="621" height="1344" data-path="images/element-explanations.png" />
</div>
