+ 4

Just how similar is C++ to C? Can every C code run in C++?

I solved the security problem in Code coach with C. That's the only language I know. I then copied my code and pasted it as a C++ entry. And it not only ran but passed all the test cases and awarded me more XP. So I want to know if C++ can run all C codes so I can just move to C++ instead.

16th Dec 2020, 11:37 AM
Sekiro
Sekiro - avatar
12 Antworten
+ 3
Most of the time, C code can be run fine on C++. But just most of the time. Here are a few exceptions (there are more beyond the post given): https://www.geeksforgeeks.org/write-c-program-wont-compiler-c/
16th Dec 2020, 11:51 AM
你知道規則,我也是
你知道規則,我也是 - avatar
+ 2
Aysha Simra Yes. Thanks
16th Dec 2020, 4:50 PM
Sekiro
Sekiro - avatar
+ 2
Simple answer yes. Most c programs can work on c++, they both basically run on mingw compilers
18th Dec 2020, 9:59 AM
Abdul Lee🎌🇳🇬
Abdul Lee🎌🇳🇬 - avatar
+ 1
See at the basics both the languages are almost same but where the level highers the differences between them are noticable so they aren't that same .🤗
16th Dec 2020, 11:39 AM
✨SARANG✨
✨SARANG✨ - avatar
+ 1
C++ superset of C. C++ has tons of features, but C is the simplest language I studied.
16th Dec 2020, 11:42 AM
Flash
+ 1
KTM Hacker Thanks man
16th Dec 2020, 11:44 AM
Sekiro
Sekiro - avatar
+ 1
Welcome
16th Dec 2020, 11:46 AM
✨SARANG✨
✨SARANG✨ - avatar
+ 1
CarrieForle I've read through it. So C++ is basically a stricter version of C that supports classes. Thanks a lot
16th Dec 2020, 12:11 PM
Sekiro
Sekiro - avatar
0
Flash oh. Thanks
16th Dec 2020, 11:45 AM
Sekiro
Sekiro - avatar
0
C++ is an advanced version of C C++ is an object oriented programming language while C is procedural oriented so C++ code cannot run in C but vice versa is possible though not completely
17th Dec 2020, 4:27 PM
Swaya