bad_alloc

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

int main()
{
 try
 {
  for (int i=1; i<=100; i++)
  {
   new int[70000000];
   cout << i << "번째 배열이 생성되었습니다." << endl;
  }
 }
 catch (bad_alloc &e)
 {
  cout << "Exception : " << e.what() << endl;
 }

 return 0;
}

 

'프로그래밍언어 > C & CPP' 카테고리의 다른 글

C++ 기본 예제  (0) 2014.07.21
C++ 강의자료 8주차  (0) 2014.07.19
파일 입출력  (0) 2014.07.17
문자열 표준 함수  (0) 2014.07.17
구조체 RECT  (0) 2014.07.16

+ Recent posts