preprocessor directive in c

C #error preprocessor directive

This preprocessor directive is used only for the debugging purpose. #error directive stops compilation and displays a error message attached with this The syntax is

#error message
for example
#ifdef MACRO
#error MACRO is not define
#endif

#include<stdio.h>
#ifndef __MATH_H
#error Compiler Time Error
#else
void main()
{
float f;
f=sqrt(7);
printf("%f",f);
}
#endif

#error Compiler Time Error

#pragma startup and #pragma exit: These directives very helpful to specify the functions to run before program startup( before the main() function) and just before program exit (Terminate)(just before the control returns from main()). This directive is a special directive and also used for turn on or off some features. This type of directives are compiler dependent i.e., it may be very from compiler to compiler.

Look at the below program:

Below program will not work with GCC compilers

#include<stdio.h>
void func0();
void func1();
#pragma startup func0
#pragma exit func1
void func0()
{
printf("Inside func0()\n");
}
void func1()
{
printf("Inside func1()\n");
}
int main()
{
printf("Inside main()\n");
return 0;
}

Inside main()