C++ Program to Show Unreachable Code Error Last Updated : 25 Jul, 2022 Improve Improve Like Article Like Save Share 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 } Output 3 Like Article Suggest improvement Previous C++ Program To Print Floyd's Triangle Next Difference Between deque::assign and deque::back in C++ Share your thoughts in the comments Add Your Comment Please Login to comment...