On this page
  1. LINE
  2. Availability
  3. Syntax & Overview
  4. Notes & Pitfalls
  5. Example

LINE

Prev: __FILE__ | Up: builtins | Next: __STDC_VERSION__
Rel: __FILE__, __func__
Ref: cppreference — LINE
Tags: #public #prog #c #builtins #tier/core


Availability

Built-in (Predefined Macro) — requires no #include header.

Syntax & Overview

__LINE__

Expands to an integer constant representing the current line number in the source file.

Notes & Pitfalls

Example

#include <stdio.h>

#define LOG(msg) fprintf(stderr, "%s:%d: %s\n", __FILE__, __LINE__, (msg))
int main(void) { LOG("ready"); }

Linked from

Related notes