Answers

Question and Answer:

  Home  C Preprocessor

⟩ 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 -

#include

int main ()

{

#error I am Error and while i am here i will not let this program compile :-) .

return 0;

}

 175 views

More Questions for you: