The #line is a preprocessor directive in C programming language; it is used to reset the line number in the code. We can reset line number from any line in the code.
Example:
#include <stdio.h> /*line 1*/ /*line 2*/ int main(){ /*line 3*/ /*line 4*/ printf("Hello world\n"); /*line 5*/ //print current line /*line 6*/ printf("Line: %d\n",__LINE__); /*line 7*/ //reset the line number by 36 /*line 8*/ #line 36 /*reseting*/ //print current line /*line 36*/ printf("Line: %d\n",__LINE__); /*line 37*/ printf("Bye bye!!!\n"); /*line 39*/ /*line 40*/ return 0; /*line 41*/ } /*line 42*/
Output
Hello world Line: 7 Line: 37 Bye bye!!!
total answers (1)
start bookmarking useful questions and collections and save it into your own study-lists, login now to start creating your own collections.
Example:
Output
need an explanation for this answer? contact us directly to get an explanation for this answer