assert is used to test conditional expressions in the DEBUG version of the program.
If the condition is false, output a diagnostic message and terminate the program.
Since assert is a macro, using it too frequently will affect the performance of the program to a certain extent, adding extra overhead. A good programming practice is to disable the assert macro by inserting #define NDEBUG before the #include statement after debugging.