Windows atexit函数

程序意外崩溃或者自然关闭,执行制定函数

#include <cstdlib>
#include <iostream>
using namespace std;


void customized_exit()
{
	printf("exit main to execute\n");
}


int main(int argc, char** argv)
{

	atexit(customized_exit);

	printf("enter anything to end program\n");
	//getchar();

	int a[4];
	a[8] = 0;

	float _test = -120.369;
	unsigned int x = -2;
	float ptm = x;

	int dm = x;
	 
	bool rt = x > 0; 
	bool rt2 = x < 1200;

	printf("unsigned int: %f %d %d %d\n", ptm, rt, rt2, dm);

	getchar();

	return 0;
}

  

posted @ 2020-03-31 14:33  采男孩的小蘑菇  阅读(345)  评论(0编辑  收藏  举报