Sunday 17 July 2011

To execute a function before the main() get executed

CODE:
#include<stdio.h>
#include<conio.h>


void wish()
{
 printf("\nHello ");
}


#pragma startup wish 
/*this preprocessor statement make wish() 
get first executed before main()*/


void main()
{
 printf("Coder!");
 getch();
}


OUTPUT:
Hello Coder!

No comments:

Post a Comment