The __LINE__ macro

i never actually knew that there was a macro provided by ANSI C which contains the current line number of execution , it is the __LINE__ macro here is a sample program to show its usage and after that follows the ouput :

int main (){
int a;
printf("\nHello testing the use of the __LINE__macro \n");
a=__LINE__;
printf("The current line number is 5 \n and the value of __LINE__ is :%d \n",a);
return 0 ;
}

Output:

Hello testing the use of the __LINE__macro
The current line number is 5
and the value of __LINE__ is :5


the preprocessor directives such as #include do not come under program lines so i have not included them here ....

Comments

Satish said…
now that actually seems to be a little trivial one, there also other macros provided such as __FILE__ which specifies the name of the source file being executed,..........

Popular posts from this blog

Was history ! :)

installing RadRails on Eclipse ...........