Standard C++ contains several built-in exception classes, std::bad_array_new_length is one of them.It is an exception on bad array length and thrown if the size of array is less than zero and if the array size is greater than the limit. Below is the syntax for the same:
Return: The std::bad_array_new returns a null terminated character that is used to identify the exception.
Note: To make use of std::bad_array_new, one should set up the appropriate try and catch blocks.
Below are the Programs to understand the implementation of std::bad_array_new in a better way:
Don’t stop now and take your learning to the next level. Learn all the important concepts of Data Structures and Algorithms with the help of the most trusted course: DSA Self Paced. Become industry ready at a student-friendly price.
- std::bad_weak_ptr class in C++ with Examples
- std::is_trivially_copy_assignable class in C++ with Examples
- std::uniform_real_ distribution class in C++ with Examples
- C++ boost::dynamic_bitset Class with Examples
- Difference between Base class and Derived class in C++
- How to convert a class to another class type in C++?
- std::any Class in C++
- std::hash class in C++ STL
- Array class in C++
- std::string class in C++
- std:: valarray class in C++
- Structure vs class in C++
- How to implement our own Vector Class in C++?
- Virtual base class in C++
- C++ string class and its applications
- C++ String Class and its Applications | Set 2
- Difference between namespace and class
- Friend class and function in C++
- Why is the size of an empty class not zero in C++?
- What all is inherited from parent class in C++?
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.