#line directive in c


It tells the compiler that next line of source code is at the line number which has been specified by constant in #line directive i.e it transfer the program control to the line number which has been specified by #line directive.
Example:

#include<stdio.h>
#line 15
int main(){
    int a=10;
    a++;
    a++;
    #line 5
    printf("%d",a);
}
If we will see its intermediate file then before the actual compilation the source code is expanded as :



In the very long c program for debugging purpose if we want to check the program after the line 300 by F7 key then we will write #line 20







  • Preprocessor definitions in c
  • Preprocessor directive in c
  • #include directive in c
  • # define directive in c
  • Pragma directive in c
  • Warning directive
  • Preprocessor operators in c
  • # if directive in c
  • #line directive in c
  • # error directive in c
  • # elif in c
  • # ifdef and #endif in c
  •  # ifndef in c example
  • #undef in c
  • What is header file in ?
  • C preprocessor questions
  • C tutorial home.
  • 2 comments:

    Anonymous said...

    how to see the intermediate file

    ritesh kumar said...

    In command prompt write: CPP fileName.c