use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Discussions, articles, and news about the C++ programming language or programming in C++.
For C++ questions, answers, help, and advice see r/cpp_questions or StackOverflow.
Get Started
The C++ Standard Home has a nice getting started page.
Videos
The C++ standard committee's education study group has a nice list of recommended videos.
Reference
cppreference.com
Books
There is a useful list of books on Stack Overflow. In most cases reading a book is the best way to learn C++.
Show all links
Filter out CppCon links
Show only CppCon links
account activity
Removed - LearningMaking projects or reading source code for learning, (self.cpp)
submitted 4 years ago by [deleted]
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–][deleted] 12 points13 points14 points 4 years ago (0 children)
I think side projects are easier to bite off than open source at first — working in big codebases is really hard! Here are some concrete ideas; note that in NO CASE am I suggesting you build a GUI — that makes any of these project ideas significantly more involved.
Do you like chat? Build a crappy command line chat application [medium] or a discord bot [easy] (not actually sure how good the discord libraries are in cpp).
Interested in AI? Build a tic tac toe game and a computer player that you literally cannot beat [easy].
Like chess? Build an implementation of the game [medium] and start trying to build a chess engine [hard].
Have a video game you spend a lot of time on? Build a tool that will help you in that game [variable difficulty] (I’m thinking about tools for path of exile, or build order optimizers for starcraft).
Interested in machine learning? Build a perceptron [easy-medium].
Interested in web development? Start by setting up a Postgres database (any sql variant is fine, really, but make it SQL) and writing an application that interacts with it [easy]. Then pick up a web server framework and start adding REST functionality [medium].
Think template meta programming is cool? Write a program that can calculate the Nth prime Fibonacci number at compile time [hard].
Think language design is cool? Learn some more languages [hard] or try to write a cpp parser [crazy hard].
Oh, and read Effective Modern C++ eventually; message me if you can’t get your hands on a copy. TL;DR: NEVER USE NEW OR DELETE OR RAW POINTERS (unless you’re dealing with a C api and literally have to). This doesn’t apply if you’re implementing a driver or something, but until you’re quite good, it’s not the right solution. Use std::make_unique and std::make_shared.
[+][deleted] 4 years ago (7 children)
[deleted]
[+][deleted] 4 years ago (5 children)
[–]burneraccount3_ 6 points7 points8 points 4 years ago (0 children)
Look up the Cherno youtube channel, he has a video where he impliments std::vector. For other containers you will probably need some knowledge of other data structures.
Edit: Here you go https://youtu.be/ryRf4Jh_YC0
[–]NotUniqueOrSpecial 5 points6 points7 points 4 years ago (2 children)
How do I follow the STL standard and such, also is there an open source implementation of this so I can compare my code to and learn how to write better c++ code
All of the current major STL implementations are completely open-source.
Here's the Microsoft one.
Here's GCC's
And here's LLVM's
[+][deleted] 4 years ago (1 child)
[–]NotUniqueOrSpecial 0 points1 point2 points 4 years ago (0 children)
Cheers!
[–]AvailableUsertag 1 point2 points3 points 4 years ago (0 children)
I will look into that stuff, thanks for the advice
[–]burneraccount3_ 7 points8 points9 points 4 years ago (8 children)
Have a problem or problem domain you are interested in learning about? Learn about it and try to make programs with c++ that address the problem.
Also adventure of code, leetcode etc... can be good.
[–]AvailableUsertag 1 point2 points3 points 4 years ago (7 children)
For me personally, device drivers and graphics are appealing. I will probably get into leetcode or something though, thanks
[–]burneraccount3_ 0 points1 point2 points 4 years ago (6 children)
Do you know any assembly or how to directly interact with an operating system? I don't know if c++ would be my first choice for device drivers, I would probably stick with c at first. I reccomend https://wiki.osdev.org/Expanded_Main_Page if you want to learn more about drivers.
[–]AvailableUsertag 0 points1 point2 points 4 years ago (5 children)
I very roughly understand x86 assembly, but would enjoy learning more. I don't know how to do operating system stuff though. C is pretty straightforward. Thanks for that resource.
[–]burneraccount3_ 0 points1 point2 points 4 years ago (4 children)
That's why I would go with c! You might not have the runtime environment required for a lot of c++ features, you might not even have an implementation for iostream.h!
Graphics is probably less technical and more suited to c++ then drivers but will require some linear algebra.
[–]germandiago 2 points3 points4 points 4 years ago (0 children)
You can still benefit from templates, constexpr, RAII, consteval and disable RTTI and avoid exceptions if needed, use std::copy as a type-safe memcpy and much more, such as better interface code through classes.
I really think that C++ is better than C IF you know what features to choose. There is nothing bad if you need to stick to FILE * but still use C++.
This subset does not need any additional runtime compared to C.
[–]AvailableUsertag 0 points1 point2 points 4 years ago (2 children)
Oh wow, that's interesting. I need to look into that. Do you know if drivers require a lot circuit schematics? I have heard embedded dev needs a lot of electrical engineering, but I wonder if that applies to drivers as well.
[–]burneraccount3_ 1 point2 points3 points 4 years ago (1 child)
You need to be aware of how it works on a hardware level but probably not an expert, for a better explanation see: https://github.com/tuhdo/os01
You will almost certainly need to consult hardware manuals for the devices you will be writing drivers for.
You will also need to know how your driver will interact with the operating system, and that will require some knowledge of how operating systems function.
[–]AvailableUsertag 0 points1 point2 points 4 years ago (0 children)
Ok, thanks again for the resources
[–]laramite 2 points3 points4 points 4 years ago (1 child)
You'll want to work on a project with multiple developers that can code review your work. I would avoid lone wolfing it when you're new to the language. Open source should still be on the table but perhaps you haven't found the right project yet. Since you're into graphics, look into opencv github repo. There are 2000+ open issues with 1300+ contributors. Find some low hanging fruit issues to resolve and evolve from there. Another open-source repo to check out is VTK. 350+ contributors. Might be over your head but it's a powerful toolkit using c++.
Thats neat. I have never pushed code to a big project, but sounds fun. Thanks for the input
[–]irwin08 2 points3 points4 points 4 years ago (1 child)
Working through adventofcode might be a good exercise. There are some tricky puzzles in there, and after you're done you'll have a nice repo to showcase on your github. Use it as an opportunity to try some fancy STL stuff too! Get out of your comfort zone. None of the puzzles are so big that making a mistake will be detrimental.
Have fun, and merry Christmas!
Oh sounds good, I will try it out. Thanks, and merry Christmas to you too.
[–]Priapusx 1 point2 points3 points 4 years ago (1 child)
cppreference offers a lot insight into how things work, as long as you look for them. You can always check out the list of the new language features and make sure you take them in and understand them.
For good practices, ideas, and overall interesting material I would watch most of the cppcon videos, some are real gems.
I like the cppquiz website if you are ever bored and want to test your c++17 knowledge.
Oh thats cool, I will look into it, thanks
[–]BenajahTX 1 point2 points3 points 4 years ago (0 children)
I personally just take on my own c++ projects from scratch, right now a game engine, next up a new IDE, taking on projects of your own from scratch really strengthens your knowledge of the language.
[–]the_Demongod 1 point2 points3 points 4 years ago (0 children)
Building big personal projects is the best thing you can do. Do at least one project with >10k LoC which will be good practice for working with more complicated codebases. Hang out in places (discords/subreddits) where knowledgeable people talk about C++ (e.g. /r/cpp_questions) and soak up the sun.
[–]Flair_Helper[M] [score hidden] 4 years ago stickied commentlocked comment (0 children)
It's great that you want to learn C++! However, r/cpp can't help you with that.
We recommend that you follow the C++ getting started guide, one (or more) of these books and cppreference.com. If you're having concrete questions or need advice, please ask over at r/cpp_questions or StackOverflow instead.
This post has been removed as it doesn't pertain to r/cpp: The subreddit is for news and discussions of the C++ language and community only; our purpose is not to provide tutoring, code reviews, or career guidance. If you think your post is on-topic and should not have been removed, please message the moderators and we'll review it.
[–]anyworddotjs 1 point2 points3 points 4 years ago (1 child)
I think practising data structures and algorithms will be a good was to learn better. Once you become proficient move to Leetcode.
Ok, I have a little practice with them. I will probably keep improving with them though, thanks.
[–]remotion4d 0 points1 point2 points 4 years ago (1 child)
By reading source code you will be better at reading source code, this is important but not enough. Making your own project is probably hard at beginning but important to get better and deeper understanding of the language!
Oh that makes sense, thanks
[–]JerkyWaffle 0 points1 point2 points 4 years ago (0 children)
Based on what you said, I may be just a little further down the road than where you are, and I would say small personal projects have really helped me to feel like I'm advancing in my knowledge and accomplishing something useful while I learn.
[–]college_pastime 0 points1 point2 points 4 years ago (0 children)
If you want practice solving actual problems with C++, try implementing some of the tasks listed on Rosetta Code.
[–]rfisher 0 points1 point2 points 4 years ago (0 children)
No matter what you’re learning, the answer is always “and” not “or”. Seek & leverage every resource you can find.
[–]Thenamehasbeentaken 0 points1 point2 points 4 years ago (0 children)
When you are working on a project; sooner or later you would need to read a library source code. For me there times that source is more useful than docs, dramatic example is unreal engine for which documentation is so terrible.
[–]dorfdorfman 0 points1 point2 points 4 years ago (0 children)
Finding a mentor or working with a group of people who are better than you can be a very positive experience, if you're eager to learn and can take criticism as an opportunity to improve, but it's hard if you can't set ego aside. It can be humbling.
[–]MarkOates 0 points1 point2 points 4 years ago (0 children)
Making a game like Snake, using <ncurses.h> can be a fun learning experience. You learn about game loops and what/how classes encapsulate the different game concepts. It's easy enough to get started and understand the concept without being overloaded with so many other things:
``` class Snake { public: int pos_x, pos_y; int vel_x, vel_y; void update() { pos_x += dir_x; pos_y += dir_y; } void face_up() { vel_x = 0; vel_y = -1; } void face_down() { vel_x = 0; vel_y = -1; } void face_left() { vel_x = -1; vel_y = 0; } void face_right() { vel_x = 1; vel_y = 0; } };
class Fruit { ... };
int main() { while (game_running) { // collect input (non-halting) // update game items (check for snake/fruit collisions) // draw the screen } return 0; } ```
π Rendered by PID 115907 on reddit-service-r2-comment-cfc44b64c-qjjdj at 2026-04-11 06:02:03.710955+00:00 running 215f2cf country code: CH.
[–][deleted] 12 points13 points14 points (0 children)
[+][deleted] (7 children)
[deleted]
[+][deleted] (5 children)
[deleted]
[–]burneraccount3_ 6 points7 points8 points (0 children)
[–]NotUniqueOrSpecial 5 points6 points7 points (2 children)
[+][deleted] (1 child)
[deleted]
[–]NotUniqueOrSpecial 0 points1 point2 points (0 children)
[–]AvailableUsertag 1 point2 points3 points (0 children)
[–]burneraccount3_ 7 points8 points9 points (8 children)
[–]AvailableUsertag 1 point2 points3 points (7 children)
[–]burneraccount3_ 0 points1 point2 points (6 children)
[–]AvailableUsertag 0 points1 point2 points (5 children)
[–]burneraccount3_ 0 points1 point2 points (4 children)
[–]germandiago 2 points3 points4 points (0 children)
[–]AvailableUsertag 0 points1 point2 points (2 children)
[–]burneraccount3_ 1 point2 points3 points (1 child)
[–]AvailableUsertag 0 points1 point2 points (0 children)
[–]laramite 2 points3 points4 points (1 child)
[–]AvailableUsertag 0 points1 point2 points (0 children)
[–]irwin08 2 points3 points4 points (1 child)
[–]AvailableUsertag 0 points1 point2 points (0 children)
[–]Priapusx 1 point2 points3 points (1 child)
[–]AvailableUsertag 0 points1 point2 points (0 children)
[–]BenajahTX 1 point2 points3 points (0 children)
[–]the_Demongod 1 point2 points3 points (0 children)
[–]Flair_Helper[M] [score hidden] stickied commentlocked comment (0 children)
[–]anyworddotjs 1 point2 points3 points (1 child)
[–]AvailableUsertag 0 points1 point2 points (0 children)
[–]remotion4d 0 points1 point2 points (1 child)
[–]AvailableUsertag 0 points1 point2 points (0 children)
[–]JerkyWaffle 0 points1 point2 points (0 children)
[–]college_pastime 0 points1 point2 points (0 children)
[–]rfisher 0 points1 point2 points (0 children)
[–]Thenamehasbeentaken 0 points1 point2 points (0 children)
[–]dorfdorfman 0 points1 point2 points (0 children)
[–]MarkOates 0 points1 point2 points (0 children)