C/C++中Main之后执行的函数_艾孜尔江撰

时间:2021-06-15 18:03:29   收藏:0   阅读:0
#include <iostream>
#include <cstdlib>
using namespace std;


int func1(),func2(),func3();

int main(int argc,char * argv[])
{
	_onexit(func2); //函数注册时入栈,调用时出栈 
	_onexit(func1);                   
	_onexit(func3);
	cout<<"First Line"<<endl;
	cout<<"Second Line"<<endl;
}

int func1()
{
	cout<<"fun1() is executed!"<<endl;
	return 0;
}

int func2()
{
	cout<<"fun2() is executed!"<<endl;
	return 0;
}
int func3()
{
	cout<<"fun3() is executed!"<<endl;
	return 0;
}
评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!