Where can I begin learning C/C++?
I just got my own Raspberry Pi 4 hoping to learn and practice programming, most notably I’d like to learn C++. The only thing is, I have no guidance and I have no idea where to start. Can anyone offer some help on the matter? What software to download? Any tutorials or educational videos?
-
- Posts: 1767
- Joined: Mon Jun 11, 2018 11:22 am
Re: Where can I begin learning C/C++?
hi,
I would recommend to start with this one:
http://fractal.math.unr.edu/~ejolson/pi ... dified.pdf (revised MagPi version)
(ask 3 people and you'll get 4 opinions
)
I would recommend to start with this one:
http://fractal.math.unr.edu/~ejolson/pi ... dified.pdf (revised MagPi version)
(ask 3 people and you'll get 4 opinions

hobby programming retiree, ♂, GER
- DougieLawson
- Posts: 42160
- Joined: Sun Jun 16, 2013 11:19 pm
- Location: A small cave in deepest darkest Basingstoke, UK
Re: Where can I begin learning C/C++?
Languages using left-hand whitespace for syntax are ridiculous
DMs sent on https://twitter.com/DougieLawson or LinkedIn will be answered next month.
Fake doctors - are all on my foes list.
The use of crystal balls and mind reading is prohibited.
DMs sent on https://twitter.com/DougieLawson or LinkedIn will be answered next month.
Fake doctors - are all on my foes list.
The use of crystal balls and mind reading is prohibited.
Re: Where can I begin learning C/C++?
I found Code::Blocks is a great IDE that helps set files up for simple coding.
Much smaller learning curve than Eclipse and other big IDE's.
It comes with some simple examples.
You can also learn a lot by using the Arduino tools.
Plenty of libraries and examples for all sort of interesting things.
Do you want to learn software engineering or use coding to make things?
Much smaller learning curve than Eclipse and other big IDE's.
It comes with some simple examples.
You can also learn a lot by using the Arduino tools.
Plenty of libraries and examples for all sort of interesting things.
Do you want to learn software engineering or use coding to make things?
I'm dancing on Rainbows.
Raspberries are not Apples or Oranges
Raspberries are not Apples or Oranges
-
- Posts: 1767
- Joined: Mon Jun 11, 2018 11:22 am
Re: Where can I begin learning C/C++?
much easier than code::blocks is Geany as an IDE (already pre-installed in Raspbian).
It's also used by the MagPi C tutorial I have linked to above.
I would recommend to start wth this because it's
a) for Raspberry Pi users
b) for complete newbies to C
c) for complete newbies to programming on the Linux OS.
Try that for a start and see how it works and perhaps then see how to proceed further on.
It's also used by the MagPi C tutorial I have linked to above.
I would recommend to start wth this because it's
a) for Raspberry Pi users
b) for complete newbies to C
c) for complete newbies to programming on the Linux OS.
Try that for a start and see how it works and perhaps then see how to proceed further on.
hobby programming retiree, ♂, GER
-
- Posts: 2164
- Joined: Tue Mar 20, 2018 9:53 pm
Re: Where can I begin learning C/C++?
I would start with C and then move to C++
This book was great as an introduction
Mike McGrath
C Programming in easy steps
Also these videos on YouTube were great
https://www.youtube.com/playlist?list=P ... fwEGES2oIW
This book was great as an introduction
Mike McGrath
C Programming in easy steps
Also these videos on YouTube were great
https://www.youtube.com/playlist?list=P ... fwEGES2oIW
Re: Where can I begin learning C/C++?
And what about learning modern c++ style? Do you have any resource to learn the new features of the lenguage?
-
- Posts: 2164
- Joined: Tue Mar 20, 2018 9:53 pm
Re: Where can I begin learning C/C++?
If you're asking me I started a thread asking about that, C++ and where to start learning. if you don't know C Programming you'll have a harder time of it. There was a video introduction on YouTube it's 4 hours https://youtu.be/vLnPwxZdW4Y this is just very basic. Take a look in the thread it has very good suggestions.
https://www.raspberrypi.org/forums/view ... 3&t=248803
My best advice is don't try to learn it all at once pick something like string and learn that first then move to something else.
-
- Posts: 950
- Joined: Tue Dec 15, 2015 4:55 pm
- Location: Detroit, MI USA
Re: Where can I begin learning C/C++?
learncpp.com
Buckys c++ tutorials on youtube
It's technically a bit dated but for a noob I still highly recommend "C++ for dummies"
As far as IDEs, I really don't like geany and find codeblocks much friendlier. I haven't run it on a Pi 4, but if you have problems with it randomly crashing PM me and I'll dig up my notes on the fix. It was an easy fix... I just don't remember what it was off the top of my head, but I haven't written somewhere.
Buckys c++ tutorials on youtube
It's technically a bit dated but for a noob I still highly recommend "C++ for dummies"
As far as IDEs, I really don't like geany and find codeblocks much friendlier. I haven't run it on a Pi 4, but if you have problems with it randomly crashing PM me and I'll dig up my notes on the fix. It was an easy fix... I just don't remember what it was off the top of my head, but I haven't written somewhere.
Robotics tips, hacks, book extras https://youtube.com/practicalrobotics
-
- Posts: 1767
- Joined: Mon Jun 11, 2018 11:22 am
Re: Where can I begin learning C/C++?
as stated,
remember:
KISS = Keep it simple, stupid.
this is the best way to start for noobs, and it uses Geany.dsyleixa123 wrote: ↑Wed Oct 02, 2019 9:01 amhi,
I would recommend to start with this one:
http://fractal.math.unr.edu/~ejolson/pi ... dified.pdf (revised MagPi version)
(ask 3 people and you'll get 4 opinions)
remember:
KISS = Keep it simple, stupid.
hobby programming retiree, ♂, GER
Re: Where can I begin learning C/C++?
DarkElvenAngel,
But don't wait till fully understanding C++ strings before moving on. That could take a lifetime:
https://www.youtube.com/watch?v=PNRju6_yn3o
That is good advice.My best advice is don't try to learn it all at once pick something like string and learn that first then move to something else.
But don't wait till fully understanding C++ strings before moving on. That could take a lifetime:
https://www.youtube.com/watch?v=PNRju6_yn3o
Memory in C++ is a leaky abstraction .
Re: Where can I begin learning C/C++?
As someone who has been in your exact situation, this is my 2 cents.
YOUTUBE IS YOUR GOD!
I am now working as a software-hardware engineer and learned everything from youtube(learn to sort search results by playlist to find full courses). Your time is important and traditional methods(books and classes) of learning are very slow compared to tutorial videos(follow along with them). I will tell you a few things about c++ that are important.
For a very low-level beginner tutorial check out thenewboston or someone else on youtube. Very simple (not professional) but easy to understand and follow. He's a great starting place for these things.
https://www.youtube.com/user/thenewboston
C++ is like an ocean. There is massive depth to it. If you stick with it you will still be learning things years later. However, you can still get by on the surface(maybe not a job though). The one thing you should know as you learn all these complex topics like software architecture(model-view-controller), OOP, testing, pointers, references, classes, public, private, structs or even functions is this.
They are not required. The hardest part about coding, in general, is not coding but structuring it properly. This is the big difference between professional and amateur software development. These complex topics are simply ways to better structure your code. Remember this as you progress, I used to think "I just need to get it to work" this is wrong, getting it to just work is normally easy. Making it maintainable, scalable, easy to debug, tested and easy to read with good documentation is far harder.
If you do not know how to do any coding at all, python is a great start because syntax is easy. Once you learn a language though it's easy to learn all of them. But, all software (including python) is difficult to make professional with good structure. Again, the truly difficult thing about software is structure, not function.
YOUTUBE IS YOUR GOD!
I am now working as a software-hardware engineer and learned everything from youtube(learn to sort search results by playlist to find full courses). Your time is important and traditional methods(books and classes) of learning are very slow compared to tutorial videos(follow along with them). I will tell you a few things about c++ that are important.
For a very low-level beginner tutorial check out thenewboston or someone else on youtube. Very simple (not professional) but easy to understand and follow. He's a great starting place for these things.
https://www.youtube.com/user/thenewboston
C++ is like an ocean. There is massive depth to it. If you stick with it you will still be learning things years later. However, you can still get by on the surface(maybe not a job though). The one thing you should know as you learn all these complex topics like software architecture(model-view-controller), OOP, testing, pointers, references, classes, public, private, structs or even functions is this.
They are not required. The hardest part about coding, in general, is not coding but structuring it properly. This is the big difference between professional and amateur software development. These complex topics are simply ways to better structure your code. Remember this as you progress, I used to think "I just need to get it to work" this is wrong, getting it to just work is normally easy. Making it maintainable, scalable, easy to debug, tested and easy to read with good documentation is far harder.
If you do not know how to do any coding at all, python is a great start because syntax is easy. Once you learn a language though it's easy to learn all of them. But, all software (including python) is difficult to make professional with good structure. Again, the truly difficult thing about software is structure, not function.
Last edited by charels on Mon Oct 07, 2019 10:37 pm, edited 2 times in total.
Re: Where can I begin learning C/C++?
Very sage advice charels.
There is a vast amount of useful guides and tutorials on YouTube. Especially effective if you find something that is pitched at your level of knowledge and understanding. Perhaps the second best thing to having people around who know what they are doing to guide you.
I would advise against sitting down and watching all the presentations from CppCon conferences https://www.youtube.com/user/CppCon/playlists. They are a brilliant way to find out what is new in the new C++ standards but they will also convince you that C++ is so huge and complex that it is absurd to even think about learning it. It's a recurring theme there as they discuss ways to make things easier for beginners over the years.
Aside: I have heard it said many tines that it takes 2 or more years to "on board" a new developer in professional circles.
Structuring programs as they get bigger is a huge problem in any language. When you start out programming you may not even be aware that it's something that you need to do or why. It can be years before one gets the experience to start making a good job of that.
There is a vast amount of useful guides and tutorials on YouTube. Especially effective if you find something that is pitched at your level of knowledge and understanding. Perhaps the second best thing to having people around who know what they are doing to guide you.
I would advise against sitting down and watching all the presentations from CppCon conferences https://www.youtube.com/user/CppCon/playlists. They are a brilliant way to find out what is new in the new C++ standards but they will also convince you that C++ is so huge and complex that it is absurd to even think about learning it. It's a recurring theme there as they discuss ways to make things easier for beginners over the years.
Aside: I have heard it said many tines that it takes 2 or more years to "on board" a new developer in professional circles.
Structuring programs as they get bigger is a huge problem in any language. When you start out programming you may not even be aware that it's something that you need to do or why. It can be years before one gets the experience to start making a good job of that.
Memory in C++ is a leaky abstraction .
Re: Where can I begin learning C/C++?
For learning C I think the arduino platform is probably a very good start as its 100% practically focused And Every Library resource is provided with an example sketch (program) executing the functions in the clearest manner for you to walk through.
Pick a project that will provide a useful result for you as a goal is a great learning motivator.
Pick a project that will provide a useful result for you as a goal is a great learning motivator.
Re: Where can I begin learning C/C++?
The Arduino uses C++.
But yes, it's a good place to get started.
But yes, it's a good place to get started.
Memory in C++ is a leaky abstraction .
Re: Where can I begin learning C/C++?
Any particular reason why you want to go with C++?
C, yes, as it underpins everything else practically. But C++ is a monster of a language, especially if beginning programming, and one of the most complex languages ever.
C, yes, as it underpins everything else practically. But C++ is a monster of a language, especially if beginning programming, and one of the most complex languages ever.
Re: Where can I begin learning C/C++?
C++
* Provides object orientated programming features
* Builds to Native code
* Is designed with an attitude of "you only pay for what you use".
* Is ported to nearly as many platforms as C is
* Has multiple implementations and a proper standard (admittedly compliance is sometimes imperfect)
* Allows the programmer to maintain libraries a stable ABI (though admittedly care is needed)
C++ certainly has a lot of warts and here are a bunch of upstart languages that would like to usurp it's role, but so-far none seem to come close.
* Provides object orientated programming features
* Builds to Native code
* Is designed with an attitude of "you only pay for what you use".
* Is ported to nearly as many platforms as C is
* Has multiple implementations and a proper standard (admittedly compliance is sometimes imperfect)
* Allows the programmer to maintain libraries a stable ABI (though admittedly care is needed)
C++ certainly has a lot of warts and here are a bunch of upstart languages that would like to usurp it's role, but so-far none seem to come close.
Re: Where can I begin learning C/C++?
sal55,
Pretty much all the computing I do rests on the GCC or LLVM compilers. LLVM is written in C++. A lot of GCC is written in C++ and as of 2012 a C++ compiler has been required to build GCC.
That leaves the Linux kernel in C, for understandable reasons, and things like OpenSSL that endlessly plague us with security vulnerabilities.
However a lot of beginners start programming with C++, using the Arduino. In the Arduino world they go out of their way to almost never mention that it is C++ and not to document most of the features of C++. That way those beginners using C++ with Arduino have a nice easy start to programming with a simple subset.
I have the feeling what the C++ world needs now is books and tutorials to present modern C++ to beginners, leaving out tons of historical baggage that no longer recommended and is only confusing.
Perhaps a task for the Raspberry Pi Foundation?
I used to think so too. Turns out that might not be true.C, yes, as it underpins everything else practically.
Pretty much all the computing I do rests on the GCC or LLVM compilers. LLVM is written in C++. A lot of GCC is written in C++ and as of 2012 a C++ compiler has been required to build GCC.
That leaves the Linux kernel in C, for understandable reasons, and things like OpenSSL that endlessly plague us with security vulnerabilities.
Indeed it is. And getting worse every year.But C++ is a monster of a language, especially if beginning programming, and one of the most complex languages ever.
However a lot of beginners start programming with C++, using the Arduino. In the Arduino world they go out of their way to almost never mention that it is C++ and not to document most of the features of C++. That way those beginners using C++ with Arduino have a nice easy start to programming with a simple subset.
I have the feeling what the C++ world needs now is books and tutorials to present modern C++ to beginners, leaving out tons of historical baggage that no longer recommended and is only confusing.
Perhaps a task for the Raspberry Pi Foundation?

Memory in C++ is a leaky abstraction .
Re: Where can I begin learning C/C++?
When you've written it, send it to The MagPi, they'll publish it I'm sure...
https://www.raspberrypi.org/magpi/issues/
PeterO
Discoverer of the PI2 XENON DEATH FLASH!
Interests: C,Python,PIC,Electronics,Ham Radio (G0DZB),1960s British Computers.
"The primary requirement (as we've always seen in your examples) is that the code is readable. " Dougie Lawson
Interests: C,Python,PIC,Electronics,Ham Radio (G0DZB),1960s British Computers.
"The primary requirement (as we've always seen in your examples) is that the code is readable. " Dougie Lawson
Re: Where can I begin learning C/C++?
Much of the original Windows APis has C interfaces (although MS have rebadged them C++, they are still C).Heater wrote: ↑Sun Oct 13, 2019 6:55 amsal55,I used to think so too. Turns out that might not be true.C, yes, as it underpins everything else practically.
Pretty much all the computing I do rests on the GCC or LLVM compilers. LLVM is written in C++. A lot of GCC is written in C++ and as of 2012 a C++ compiler has been required to build GCC.
That leaves the Linux kernel in C, for understandable reasons, and things like OpenSSL that endlessly plague us with security vulnerabilities.
The libraries I need to do stuff on Linux (via libc.so.6) have a C interface. I believe X11 has too.
Graphics such as OpenGL, SDL, Cairo, GTK have C APIs (ie. defined in terms of C data types).
Key languages such as Python will have primarily implementations (CPython) written in C.
Etc. Fortunately a lot of such things don't use C++, as they would be pretty much impossible to use from any other language that isn't C++, while, although C has its problems, using C's low-level interface is easier to adapt or to create bindings to.
So in my view C is more important than C++. That LLVM uses C++ is no surprise as LLVM is itself a monster. With C, there is a VERY fast compiler in form of Tiny C, if you want quick and snappy builds, but there is nothing equivalent for C++ (just throwing more resources at it).
Re: Where can I begin learning C/C++?
There are plenty of books on C++, but I have found none that cover the entire language, probably because its just too large.
The only complete and definitive documentation for C++ is the current ISO standard.
Perhaps a tech author should take that, add some introductory stuff, and make it more readable.
-
- Posts: 1767
- Joined: Mon Jun 11, 2018 11:22 am
Re: Where can I begin learning C/C++?
IMO a beginner is overburdened having to learn all features of a PL completely, regardless whether it's C, C++ or even different ones.
I agree about Arduino API using C++, and the reason why it has such a tremendous success is that Arduino provides step-by-step examples which are project-specific and can easily been setup on a breadboard and the running program can be easily monitored and debugged by the USB/Serial monitor : https://www.arduino.cc/en/Tutorial/BuiltInExamples
Admittedly the Arduino API examples and documentations lack an exact (optional) description of C ++ API features, but beginners learn very fast and are highly motivated by the rapid programming success, and whoever wants may get additional informations with extra examples via cplusplus.com etc.
I agree about Arduino API using C++, and the reason why it has such a tremendous success is that Arduino provides step-by-step examples which are project-specific and can easily been setup on a breadboard and the running program can be easily monitored and debugged by the USB/Serial monitor : https://www.arduino.cc/en/Tutorial/BuiltInExamples
Admittedly the Arduino API examples and documentations lack an exact (optional) description of C ++ API features, but beginners learn very fast and are highly motivated by the rapid programming success, and whoever wants may get additional informations with extra examples via cplusplus.com etc.
hobby programming retiree, ♂, GER
Re: Where can I begin learning C/C++?
I feel that c++17 and c++2a is so new that most people don't care about use it. I will stick with c++11 / c++14 for my little projects and i will forget all i have heard about "modern c++" because all those cpp conferences on youtube give me headhache.
Cesar.
Re: Where can I begin learning C/C++?
@sal55,
You are right of course. There is a lot of C code around and in use, even by me. The C ABI is in use everywhere in connecting different languages together. It is the lowest common denominator. Even used when C is not actually present, for example calling Rust functions from C# or whatever.
I love C in part because it is possible for one person to create a compiler for it in a reasonable time. Like Tiny C. Gives me hope that after the next Carrington scale solar storm we will be able to reboot computing civilization starting from scratch.
@jahboater
@cmrincon
Having watched all the CppCon presentations for the past few years they seem to spend a lot of time discussing problems with the language and suggesting ever more great new language features to layer on so as to get around them. The fractal complexity of it all is almost farcical.
You are right of course. There is a lot of C code around and in use, even by me. The C ABI is in use everywhere in connecting different languages together. It is the lowest common denominator. Even used when C is not actually present, for example calling Rust functions from C# or whatever.
I love C in part because it is possible for one person to create a compiler for it in a reasonable time. Like Tiny C. Gives me hope that after the next Carrington scale solar storm we will be able to reboot computing civilization starting from scratch.
@jahboater
Indeed. I would argue that beginners do not need or what such a book. It's too much. Even professional programmers don't know all of C++ after years and neither do they have to. What is needed is beginners books that are reasonably up to date with the way one is expected to use C++ today.There are plenty of books on C++, but I have found none that cover the entire language, probably because its just too large.
@cmrincon
Ha! Me too. That is why I decided to abandon C++ a few years back. I could do everything I need to do in Javascript and node.js, server side, browser GUI side, even remote embedded system stuff. Unless I really needed the performance of C++ I could get sophisticated things done in node.js much more quickly and easily....i will forget all i have heard about "modern c++" because all those cpp conferences on youtube give me headhache.
Having watched all the CppCon presentations for the past few years they seem to spend a lot of time discussing problems with the language and suggesting ever more great new language features to layer on so as to get around them. The fractal complexity of it all is almost farcical.
Memory in C++ is a leaky abstraction .
Re: Where can I begin learning C/C++?
Expected by who though? that is the question. Afacit C++ projects run the gamut from programs that are mostly C but with a minimal smattering of C++ features to those that go all in with the new and shiny stuff.