What is the general form of #line preprocessor?
Submitted by: MuhammadGeneral form of #line preprocessor is #line number "filename"
Here the file name is optional. Filename string replaces the string value of _ _FILE_ _ while the number changes the value of _ _LINE_ _.
The major use of #line is in debugging and rare programming situation.
Following C Source code shows the #line preprocessor in action -
#include <stdio.h>
int main ()
{
printf ("n%d", __LINE__); //Prints 6
#line 100;
printf ("n%d",__LINE__); // Prints 101
printf ("n%d", __FILE__);// Prints original source file name
#line 103 "Super C"
printf ("n%d", __FILE__); //Prints Super C
return 0;
}</stdio.h>
Submitted by: Muhammad
Here the file name is optional. Filename string replaces the string value of _ _FILE_ _ while the number changes the value of _ _LINE_ _.
The major use of #line is in debugging and rare programming situation.
Following C Source code shows the #line preprocessor in action -
#include <stdio.h>
int main ()
{
printf ("n%d", __LINE__); //Prints 6
#line 100;
printf ("n%d",__LINE__); // Prints 101
printf ("n%d", __FILE__);// Prints original source file name
#line 103 "Super C"
printf ("n%d", __FILE__); //Prints Super C
return 0;
}</stdio.h>
Submitted by: Muhammad
Read Online C Preprocessor Job Interview Questions And Answers
Top C Preprocessor Questions
☺ | Tell us bitwise shift operators? |
☺ | Can you please explain the scope of static variables? |
☺ | What do you know about the use of bit field? |
☺ | What is typedf? |
☺ | Do you have any idea about the use of "auto" keyword? |
Top C Programming Categories
☺ | C Functions Interview Questions. |
☺ | C Pointers Interview Questions. |
☺ | C Preprocessor Interview Questions. |