8个回答
展开全部
当然可以
看下面这个例子:
可以用_onexit 注册一个简慎函数,它拦李敬会在main 之后执行int fn1(void), fn2(void), fn3(void), fn4 (void);
void main( void )
{
String str("zhanglin");
_onexit( fn1 );
_onexit( fn2 );
_onexit( fn3 );
_onexit( fn4 );
printf( "This is executed first.\n" );
}
int fn1()
{
printf( "next.\n" );
return 0;
}
int fn2()
{
printf( "executed "扰铅 );
return 0;
}
int fn3()
{
printf( "is " );
return 0;
}
int fn4()
{
printf( "This " );
return 0;
}
The _onexit function is passed the address of a function (func) to be called when the program terminates normally. Successive calls to _onexit create a register of functions that are executed in LIFO (last-in-first-out) order. The functions passed to _onexit cannot take parameters.
看下面这个例子:
可以用_onexit 注册一个简慎函数,它拦李敬会在main 之后执行int fn1(void), fn2(void), fn3(void), fn4 (void);
void main( void )
{
String str("zhanglin");
_onexit( fn1 );
_onexit( fn2 );
_onexit( fn3 );
_onexit( fn4 );
printf( "This is executed first.\n" );
}
int fn1()
{
printf( "next.\n" );
return 0;
}
int fn2()
{
printf( "executed "扰铅 );
return 0;
}
int fn3()
{
printf( "is " );
return 0;
}
int fn4()
{
printf( "This " );
return 0;
}
The _onexit function is passed the address of a function (func) to be called when the program terminates normally. Successive calls to _onexit create a register of functions that are executed in LIFO (last-in-first-out) order. The functions passed to _onexit cannot take parameters.
展开全部
不液返会,没理由,就是这么规定的,一个MAIN{}是一个完整的函数,编译之后闹宏饥可以生成一个单独的可执行文件,这个可执绝团行文件不包括MAIN{}以外的东西
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
2008-03-17
展开全部
答亏亩案:可以,可以冲空旅用_onexit 注册一个函数,它会在main 之后执行int fn1(void), fn2(void), fn3(void), fn4 (void);
void main( void )
{
String str("zhanglin");
_onexit( fn1 );
_onexit( fn2 );
_onexit( fn3 );
_onexit( fn4 );
printf( "This is executed first.\n" );
}
int fn1()
{
printf( "next.\n" );
return 0;
}
int fn2()
{
printf( "executed " );
return 0;
}
int fn3()
{
printf( "is " );
return 0;
}
int fn4()
{
printf( "散凳This " );
return 0;
}
The _onexit function is passed the address of a function (func) to be called when the program terminates normally. Successive calls to _onexit create a register of functions that are executed in LIFO (last-in-first-out) order. The functions passed to _onexit cannot take parameters.
void main( void )
{
String str("zhanglin");
_onexit( fn1 );
_onexit( fn2 );
_onexit( fn3 );
_onexit( fn4 );
printf( "This is executed first.\n" );
}
int fn1()
{
printf( "next.\n" );
return 0;
}
int fn2()
{
printf( "executed " );
return 0;
}
int fn3()
{
printf( "is " );
return 0;
}
int fn4()
{
printf( "散凳This " );
return 0;
}
The _onexit function is passed the address of a function (func) to be called when the program terminates normally. Successive calls to _onexit create a register of functions that are executed in LIFO (last-in-first-out) order. The functions passed to _onexit cannot take parameters.
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
main函数结冲旁束就代表程序的结束怎么可能再执行一段腔尺代码?
main函数是通过调用其他函伍判高数而完成整个程序的!!!!!
main函数是通过调用其他函伍判高数而完成整个程序的!!!!!
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
main主函数执行完毕后悉答,为啥不能执行别的代码段呢??很奇睁雀慧怪的问题。
你只要想让它执岁笑行。写上去为啥不能执行呢?当然
对应的操作对象要分清楚。不能在submain操作的
对象肯定是不行的。这要看你这段代码涉及的内容了。
你只要想让它执岁笑行。写上去为啥不能执行呢?当然
对应的操作对象要分清楚。不能在submain操作的
对象肯定是不行的。这要看你这段代码涉及的内容了。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询