News:

GinGly.com - Used by 85,000 Members - SMS Backed up 7,35,000 - Contacts Stored  28,850 !!

Main Menu

C Program -Program to change execution of functions

Started by ganeshbala, Jun 10, 2008, 08:57 PM

Previous topic - Next topic

ganeshbala

C Program -Program to change execution of functions

/* Use of #pragma */
/* Program to change execution of functions */
void fun1( ) ;
void fun2( ) ;

#pragma startup fun1
#pragma exit fun2

main( )
{
printf ( "\nInside maim" ) ;
}

void fun1( )
{
printf ( "\nInside fun1" ) ;
}

void fun2( )
{
printf ( "\nInside fun2" ) ;
}

C Program -Demonstration of nested loops

/* Demonstration of nested loops */
main( )
{
int r, c, sum ;
for ( r = 1 ; r <= 3 ; r++ ) /* outer loop */
{
for ( c = 1 ; c <= 2 ; c++ ) /* inner loop */
{
sum = r + c ;
printf ( "r = %d c = %d sum = %d\n", r, c, sum ) ;
}
}
}