Please do not start with either C++ or C. They are horrible, horrible languages to learn as a beginner. Not because of bad tooling, incompatible compilers, tons of features, or even manual memory management and pointers, no.
Two words: undefined behavior. In other languages, if you do a mistake, something fails around the place where you did it, or at least afterwards, or at least you can reason why the failure is exactly where it is. In C++, you cannot. Accidental array bounds overflow? Too bad, now your program crashes in a completely unrelated closing bracket (not even a statement) five minutes later.
In other languages, if your program does not crash and produces a correct answer until point X, you can be more or less sure that everything afterwards at least gets corrects inputs. Not in C or C++: if there was an UB before point X, the program may look like it does random things: some stuff is printing, some stuff is shown in the debugger, random lines are executed, arithmetic operations make no sense, perfectly valid functions crash: https://stackoverflow.com/questions/54120862/does-the-c-stan...
People grow by challenging themselves and this certainly applies to programming. One can’t use training wheels and expect to become skilled at system programming.
I learned C++ as an absolute beginner in school back when most memory debugging tools didn’t even exist. Undefined behavior was just another bug that one learned to fix and most of the time it was nothing more exciting than a crash. Being disciplined avoided the problem in the first place…
People really have a tendency to dramatize C++. Yes, memory errors are a significant problem for people writing operating systems or browsers that get attacked all the time. For a beginner C++ can be much more fun and instructive than any so-called safe alternative.
Absolutely, but it's much easier to understand arrays, strings, functions, loops and structs as high-level concepts first, and continue to manual memory management and UB only afterwards, rather than trying to do everything at the same time.
C++ is fun for sure, it was (and is) fun for me, but it's a very specific kind of fun.
Tooling did help this situation somewhat, but it is not very discoverable.
If a beginner started off with a clang or gcc toolchain, then I would immediately suggest the following command line options for the compiler (the exact standard version does not matter, just stick to one):
Two words: undefined behavior. In other languages, if you do a mistake, something fails around the place where you did it, or at least afterwards, or at least you can reason why the failure is exactly where it is. In C++, you cannot. Accidental array bounds overflow? Too bad, now your program crashes in a completely unrelated closing bracket (not even a statement) five minutes later.
In other languages, if your program does not crash and produces a correct answer until point X, you can be more or less sure that everything afterwards at least gets corrects inputs. Not in C or C++: if there was an UB before point X, the program may look like it does random things: some stuff is printing, some stuff is shown in the debugger, random lines are executed, arithmetic operations make no sense, perfectly valid functions crash: https://stackoverflow.com/questions/54120862/does-the-c-stan...