C Preprocessor Question:
Download Questions PDF

What is #error and use of it?


The 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 -
int main ()
#error I am Error and while i am here i will not let this program compile :-) .
return 0;

Download C Preprocessor Interview Questions And Answers PDF

Previous QuestionNext Question
Where define directive used?What is #line?