[Practice] Preprocessor Directive #line


Submit solution

Points: 5
Time limit: 0.1s
Memory limit: 20K

Author:
Problem type
Allowed languages
C

Concept Note

#line is a preprocessor directive.

The purpose is to reset the line number and filename in the code during the execution.

Example Program

#include <stdio.h>                      // Line: 1
                                        // Line: 2
int main()                              // Line: 3
{                                       // Line: 4
                                        // Line: 5 
    printf("Line: %d\n",__LINE__);      // Line: 6
                                        // Line: 7
    #line 23                            // Line: 8,  Reseting Line Number to 23
    printf("Line: %d\n",__LINE__);      // Line: 23
    printf("Line: %d\n",__LINE__);      // Line: 24
                                        // Line: 25
    return 0;                           // Line: 26
}                                       // Line: 27

Comments

There are no comments at the moment.