DOOMguy
Posts: 1
Joined: Tue Oct 01, 2019 10:50 pm

Where can I begin learning C/C++?

Tue Oct 01, 2019 11:03 pm

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?

dsyleixa123
Posts: 423
Joined: Mon Jun 11, 2018 11:22 am

Re: Where can I begin learning C/C++?

Wed Oct 02, 2019 9:01 am

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 ;) )

User avatar
DougieLawson
Posts: 36317
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website Twitter

Re: Where can I begin learning C/C++?

Wed Oct 02, 2019 9:08 am

Note: Having anything humorous in your signature is completely banned on this forum. Wear a tin-foil hat and you'll get a ban.

Any DMs sent on Twitter will be answered next month.

This is a doctor free zone.

User avatar
Gavinmc42
Posts: 3916
Joined: Wed Aug 28, 2013 3:31 am

Re: Where can I begin learning C/C++?

Wed Oct 02, 2019 9:38 am

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?
I'm dancing on Rainbows.
Raspberries are not Apples or Oranges

dsyleixa123
Posts: 423
Joined: Mon Jun 11, 2018 11:22 am

Re: Where can I begin learning C/C++?

Wed Oct 02, 2019 9:43 am

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.

DarkElvenAngel
Posts: 182
Joined: Tue Mar 20, 2018 9:53 pm

Re: Where can I begin learning C/C++?

Thu Oct 03, 2019 2:41 pm

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

cmrincon
Posts: 40
Joined: Thu May 24, 2018 7:39 pm

Re: Where can I begin learning C/C++?

Fri Oct 04, 2019 12:22 pm

And what about learning modern c++ style? Do you have any resource to learn the new features of the lenguage?

DarkElvenAngel
Posts: 182
Joined: Tue Mar 20, 2018 9:53 pm

Re: Where can I begin learning C/C++?

Fri Oct 04, 2019 1:11 pm

cmrincon wrote:
Fri Oct 04, 2019 12:22 pm
And what about learning modern c++ style? Do you have any resource to learn the new features of the lenguage?
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.

ElEscalador
Posts: 681
Joined: Tue Dec 15, 2015 4:55 pm
Location: Detroit, MI USA
Contact: Website

Re: Where can I begin learning C/C++?

Fri Oct 04, 2019 2:01 pm

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.
My Autonomous Robot Project and a few of my other projects below.

https://lloydbrombach.wordpress.com/

dsyleixa123
Posts: 423
Joined: Mon Jun 11, 2018 11:22 am

Re: Where can I begin learning C/C++?

Fri Oct 04, 2019 2:43 pm

as stated,
dsyleixa123 wrote:
Wed Oct 02, 2019 9:01 am
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 ;) )
this is the best way to start for noobs, and it uses Geany.

remember:
KISS = Keep it simple, stupid.

Heater
Posts: 13643
Joined: Tue Jul 17, 2012 3:02 pm

Re: Where can I begin learning C/C++?

Fri Oct 04, 2019 7:00 pm

DarkElvenAngel,
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.
That is good advice.

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 .

charels
Posts: 13
Joined: Mon Jun 24, 2019 6:19 pm

Re: Where can I begin learning C/C++?

Mon Oct 07, 2019 9:04 pm

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.
Last edited by charels on Mon Oct 07, 2019 10:37 pm, edited 2 times in total.

Heater
Posts: 13643
Joined: Tue Jul 17, 2012 3:02 pm

Re: Where can I begin learning C/C++?

Mon Oct 07, 2019 10:21 pm

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.
Memory in C++ is a leaky abstraction .

PhatFil
Posts: 1421
Joined: Thu Apr 13, 2017 3:55 pm
Location: Oxford UK

Re: Where can I begin learning C/C++?

Mon Oct 07, 2019 11:13 pm

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.

Heater
Posts: 13643
Joined: Tue Jul 17, 2012 3:02 pm

Re: Where can I begin learning C/C++?

Tue Oct 08, 2019 4:01 am

The Arduino uses C++.

But yes, it's a good place to get started.
Memory in C++ is a leaky abstraction .

sal55
Posts: 59
Joined: Sat Sep 21, 2019 7:15 pm

Re: Where can I begin learning C/C++?

Sat Oct 12, 2019 10:56 pm

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.

plugwash
Forum Moderator
Forum Moderator
Posts: 3463
Joined: Wed Dec 28, 2011 11:45 pm

Re: Where can I begin learning C/C++?

Sun Oct 13, 2019 4:50 am

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.

Heater
Posts: 13643
Joined: Tue Jul 17, 2012 3:02 pm

Re: Where can I begin learning C/C++?

Sun Oct 13, 2019 6:55 am

sal55,
C, yes, as it underpins everything else practically.
I used to think so too. Turns out that might not be true.

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.
But C++ is a monster of a language, especially if beginning programming, and one of the most complex languages ever.
Indeed it is. And getting worse every year.

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 .

User avatar
PeterO
Posts: 5072
Joined: Sun Jul 22, 2012 4:14 pm

Re: Where can I begin learning C/C++?

Sun Oct 13, 2019 7:38 am

Heater wrote:
Sun Oct 13, 2019 6:55 am
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? :)
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

sal55
Posts: 59
Joined: Sat Sep 21, 2019 7:15 pm

Re: Where can I begin learning C/C++?

Sun Oct 13, 2019 9:53 am

Heater wrote:
Sun Oct 13, 2019 6:55 am
sal55,
C, yes, as it underpins everything else practically.
I used to think so too. Turns out that might not be true.

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.
Much of the original Windows APis has C interfaces (although MS have rebadged them C++, they are still C).

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).

jahboater
Posts: 4769
Joined: Wed Feb 04, 2015 6:38 pm

Re: Where can I begin learning C/C++?

Sun Oct 13, 2019 10:00 am

Heater wrote:
Sun Oct 13, 2019 6:55 am
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.
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.

dsyleixa123
Posts: 423
Joined: Mon Jun 11, 2018 11:22 am

Re: Where can I begin learning C/C++?

Sun Oct 13, 2019 10:39 am

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.

cmrincon
Posts: 40
Joined: Thu May 24, 2018 7:39 pm

Re: Where can I begin learning C/C++?

Sun Oct 13, 2019 10:59 am

Heater wrote:
Sun Oct 13, 2019 6:55 am
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.
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.

Heater
Posts: 13643
Joined: Tue Jul 17, 2012 3:02 pm

Re: Where can I begin learning C/C++?

Sun Oct 13, 2019 2:00 pm

@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
There are plenty of books on C++, but I have found none that cover the entire language, probably because its just too large.
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.

@cmrincon
...i will forget all i have heard about "modern c++" because all those cpp conferences on youtube give me headhache.
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.

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 .

plugwash
Forum Moderator
Forum Moderator
Posts: 3463
Joined: Wed Dec 28, 2011 11:45 pm

Re: Where can I begin learning C/C++?

Sun Oct 13, 2019 11:03 pm

Heater wrote:
Sun Oct 13, 2019 2:00 pm
What is needed is beginners books that are reasonably up to date with the way one is expected to use C++ today.
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.

Return to “C/C++”