fork(1) download
  1. #include <iostream>
  2. #include <array>
  3. #include <vector>
  4.  
  5. using namespace std;
  6.  
  7. int main() {
  8. try {
  9. // std::array<int,10000000> arr;
  10. std::vector<int> arr;
  11. arr.resize(1000000000);
  12. cout << arr[40] << endl;
  13. }
  14. catch(const std::exception& e) {
  15. cout << e.what() << endl;
  16. }
  17. return 0;
  18. }
Success #stdin #stdout 0s 4320KB
stdin
Standard input is empty
stdout
std::bad_alloc