exception::what() in C++ with Examples
The exception::what() used to get string identifying exception. This function returns a null terminated character sequence that may be used to identify the exception. Below is the syntax for the same:
virtual const char* what() const throw();
Return: The function std::what() return a null terminated character sequence that is used to identify the exception.
Note: To make use of std::what(), one should set up the appropriate try and catch blocks.
Below are the programs to understand the implementation of std::what() in a better way:
GeeksforGeeks!! A Computer Science Portal For Geeks