What is #error and use of it?
Submitted by: MuhammadThe use of this preprocessor is in debugging. Whenever this preprocessor is encountered during compilation the compiler would stop compilation and display the error message associated with the preprocessor in complation Output/Result Window. Depending upon compiler any other debugging information will also accompany your error message.
General form of #error is -
#error message
Also note that message doesnot need to be in double quotes.
Following source code display the use of #error preprocessor directive in C -
#include <stdio.h>
int main ()
{
#error I am Error and while i am here i will not let this program compile :-) .
return 0;
}</stdio.h>
Submitted by: Muhammad
General form of #error is -
#error message
Also note that message doesnot need to be in double quotes.
Following source code display the use of #error preprocessor directive in C -
#include <stdio.h>
int main ()
{
#error I am Error and while i am here i will not let this program compile :-) .
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. |