#line : line « Preprocessor « C Tutorial






Define arbitrary line numbers for the source lines.

Using the #line directive, you can specify an arbitrary line number at any point.

The compiler then uses that line number for subsequent counts.

#include <stdio.h>
main()
{
    printf("A\n");

     #line 100
    printf("B\n");
    printf("C FILE %s LINE %d\n", __FILE__, __LINE__ );
     #line 200

    printf("D\n");
    printf("E\n");
}
A
      B
      C FILE line0.c LINE 101
      D
      E








12.9.line
12.9.1.#line