What does this mean "Virtually any legal C program is a legal C++ program"? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 4

What does this mean "Virtually any legal C program is a legal C++ program"?

The statement in the question inside double quotes bugs me. what does that mean? please help me guys.

3rd Sep 2016, 9:08 AM
Harish
Harish - avatar
3 Answers
+ 4
C++ is meant to be the C language with augmented features and possibilities. So, any C program could be considered as a C++ program. Even though it is meant to be this way, there are in facts some differences that sometimes make a legal C program an illegal C++ program, hence the "virtually" in your sentence. Some C features were removed from C++ with C++11, C++14 and C++17, and C got some features in C99 and C11 C++ didn’t receive.
3rd Sep 2016, 9:29 AM
Lucien Cartier-Tilet
Lucien Cartier-Tilet - avatar
+ 4
I think it means C++ is an upgraded version of C. And almost all programmes written in C are compatible and can run well when ported to C++
29th Dec 2016, 12:46 PM
E_E Mopho
E_E Mopho - avatar
+ 1
Well, C++11 is C99 compliant. In other words: C++11 is a true superset (of the old standard) of C99. SoloLearn C++ still uses C++03.
3rd Sep 2016, 10:02 AM
Stefan
Stefan - avatar