Saturday, August 21, 2010

Execute function after completion of main() function in C using #pragma directive

/*This Program demonstrates the use of #pragma directive.#pragma exit can be used to call a function after main.The function must not returning anything other than void and must not contain any arguments.
  Syntax : #pragma exit function-name [priority]
  Here function-name is the name of a function and priority is optional.
  priority can be from 64 to 255.Do not use priority from 0 to 63 because they are used by C libraries.
  100 is a Default priority
  255 is a lowest priority
  Developed on       :- 28/03/2009
  Developed by       :- Malhar Vora
  Email              :- vbmade2000@gmail.com         
  WebSite            :- http://malhar2010.blogspot.com
  Development Status :- Completed
  
*************************************************************/


 #include 

void PrintChar1()
{
   printf("Hello after main1\n");
   getch();
}



#pragma exit PrintChar1


void main()
{

   printf("Hello from Main");

}

No comments:

Post a Comment