When to use C over C++, and C++ over C?

C++CObject Oriented ProgrammingProgramming

If you would like an application that works directly with computer hardware or deals with the desktop app development, C++ is an good option. C++ programs include server-side applications, networking, gaming, and even device drivers for your PC. However, if you need to code truly tiny systems, using C will result in less overhead than C++.

C++ is well-rounded in terms of platforms and target applications, so if your project is focused on extremely low-level processing, then you may want to use C++. C++ is often used for large-scale, multi-man, complex projects where separate people need to work on modularised components. You can build and maintain modularised code in C, of course, but the inherent OOP nature of C++ leads to superior modularisation, testability, and code-reuse.

So TLDR; you should only use C over C++ when −

  • You need a portable assembler. Although C++ is also portable, on very resource constrained systems, using it can be a nightmare.
  • Your platform doesn't provide C++
  • You need to interact with other languages that can only interact with C
Published on 15-Feb-2018 06:13:05