C++ Program to Show Unreachable Code Error Last Updated : 25 Jul, 2022 Comments Improve Suggest changes Like Article Like Report Unreachable code is a compile-time error in languages like C++, Java, and C or Unreachable code error occurs when the code can’t be compiled; but why it is just a warning in C++ & C ? Warnings are a way that the compiler indicates that the particular mentioned thing might become an error in future. Example: C++ // C++ Program to demonstrate // Unreacheable Code error #include <iostream> using namespace std; int c(); int main() { cout << c() << endl; return 0; } int c() { int a = 3; return a; // oops it is unreachable code int b = 6; cout << b; // program control never goes here } Output3 Comment More infoAdvertise with us Next Article C++ Program to Show Unreachable Code Error sujal01 Follow Improve Article Tags : C++ Programs C++ Practice Tags : CPP Similar Reads C++ Program to Show Types of Errors In any programming language errors is common. If we miss any syntax like parenthesis or semicolon then we get syntax errors. Apart from this we also get run time errors during the execution of code. In a similar way the errors are classified as below: Syntax Errors Runtime Errors Logical Errors Link 3 min read C++ Program to Handle the Unchecked Exceptions Exceptions are run-time errors or abnormal conditions that a program may encounter during execution. Examples: Division by zeroAccess to an array out of its boundsRunning out of memoryRunning out of disk spaceTypes of Exceptions: Synchronous Exceptions: The exceptions which occur during the program 5 min read C++ Program to Show Runtime Exceptions A runtime error occurs while the program is running. Because this is not a compilation error, the compilation will be completed successfully. Here, we will learn how to handle runtime exceptions in C++. There are 5 types of runtime exceptions discussed here: Division by zero. Segmentation faults. La 3 min read Reasons for a C++ program crash We sometimes come across abnormal crash of C++ programs. Below are some possible reasons which may cause C++ to crash abnormally. Segmentation Fault: It is the major reason for program to crash. These are may be the reasons for the such cause:Attempting to access memory location that doesn't exist i 3 min read How to use errno in C++? In C++ errno is a preprocessor macro that is used for error indication and reporting errors that occur during a function call. It contains error codes so if a call to a function fails somehow then the errno is set to a value that corresponds to the error. errno is defined in the header file <cerr 4 min read Like