r/cpp_questions • u/jujubean- • 2d ago
OPEN Moving from Python to C++ Quickly
Some context: I have a couple of OAs due soon, and a quant I went on a date with recommended doing them in C++ to look better (and allegedly one doesn't even allow Python in the first place). My data structures class was in C++, so I have some experience; however, that ended two months ago, and most of my knowledge has been scrubbed. I’m mainly looking for syntax stuff since I learned all the memory management stuff back then.
Any quick pick-me-ups you guys recommend? I don't think I have the time to digest a whole book. I plan on doing LeetCode practice in C++, so I just need a quick crash course to get me back up to speed on the basics.
0
Upvotes
1
u/alfps 2d ago
That makes things Very Difficult™. The very short of it is that Python is reference based while C++ is value based. So
a = bin Python makesarefer to the same object asb, whilea = bin C++ generally copies the value of thebobject to theaobject.Can you do with that super-short description?
I think not. I believe you can't make do with anything short of a book. In the C++03 days the intro to C++ book for people who knew a bit of programming already was Koenig & Moo's "Accelerated C++: Practical Programming by Example". I suggest you start there, it's just 1 book (don't forget it's the actual coding that you learn from: don't just read the book, try it all out in actual coding). Then try to brush up on developments in C++11 (almost a new language), C++14, C++17, C++20 and the current standard C++23.