C to C++ vs Python3 | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

C to C++ vs Python3

Hey guys. Been learning Python for a while now. Got into the varsity though & it turns out we're to learn the C language there. So I was thinking of dumping Python for C++ since game development is actually my area of interest. Pls how difficult is it to transition to C++ from C?

1st Aug 2019, 8:36 PM
Abdulbasit Ado
Abdulbasit Ado - avatar
1 Answer
0
In general C and C++ are very similar languages. C++ is extended with classes, polymorphism and other stuff but basic usage of C++ is identical to C. Comparing Python to C++ on the other hand is something completely different. C++ is strictly typed language, you can't assign anything to some variable, it has some type which you have to stick to. While in python you can do almost anything you want. You can even modify functions on the fly which is almost impossible in C++. Also, one more thing which is pretty important. In C++ you have to manage memory on your own. So if you are not paying attention to what you're doing, you can easily lead to memory leaks. Also, wrong use of C++ may lead to some security hazards. (All those bad stuff also goes with C too) But, regarding game development, I think both can be useful. Python (same goes for any other scripting language) can be used for some tools that are used in game development or to script stuff in game itself like some scenarios, behavior or AI, This way, it is very easy to achieve modability of game produced. C++ is mainly used for performance-sensitive parts of the engine. Don't get me wrong, I'm not enemy of C++, quite opposite, I'm fun of C++. But C++ is much harder, although it gives you control over almost everything, but with that comes great responsibility. :) BTW. You can also check out Rust, yet another programming language and somewhat new. It has some advantages over C++ over memory management. I went a little bit off topic. Summarising, going from C to C++ is easy, because 95% of things in C are in C++. But that doesn't mean you won't have to learn anything more in C++. You can look at C++ as if it were extension of C.
1st Aug 2019, 9:09 PM
Mateusz R
Mateusz R - avatar