C Tutorial/Preprocessor/line


Deprecated: Constant E_STRICT is deprecated in /var/www/cppe.ru/www/includes/exception/MWExceptionHandler.php on line 179

Deprecated: Creation of dynamic property PPDStack::$accum is deprecated in /var/www/cppe.ru/www/includes/parser/Preprocessor_DOM.php on line 803

Deprecated: Constant E_STRICT is deprecated in /var/www/cppe.ru/www/includes/exception/MWExceptionHandler.php on line 179

Deprecated: Constant E_STRICT is deprecated in /var/www/cppe.ru/www/vendor/mediawiki/at-ease/src/Functions.php on line 48
Материал из C\C++ эксперт
Перейти к: навигация, поиск

#line

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