0.3 — Introduction to C/C++

Before C++, there was C

The C language was developed in 1972 by Dennis Ritchie at Bell Telephone laboratories, primarily as a systems programming language (a language to write operating systems with). Ritchie’s primary goals were to produce a minimalistic language that was easy to compile, allowed efficient access to memory, produced efficient code, and was self-contained (not reliant on other programs). For a high-level language, it was designed to give the programmer a lot of control, while still encouraging platform (hardware and operating system) independence (that is, the code didn’t have to be rewritten for each platform).

C ended up being so efficient and flexible that in 1973, Ritchie and Ken Thompson rewrote most of the Unix operating system using C. Many previous operating systems had been written in assembly. Unlike assembly, which produces programs that can only run on specific CPUs, C has excellent portability, allowing Unix to be easily recompiled on many different types of computers and speeding its adoption. C and Unix had their fortunes tied together, and C’s popularity was in part tied to the success of Unix as an operating system.

In 1978, Brian Kernighan and Dennis Ritchie published a book called “The C Programming Language”. This book, which was commonly known as K&R (after the authors’ last names), provided an informal specification for the language and became a de facto standard. When maximum portability was needed, programmers would stick to the recommendations in K&R, because most compilers at the time were implemented to K&R standards.

In 1983, the American National Standards Institute (ANSI) formed a committee to establish a formal standard for C. In 1989 (committees take forever to do anything), they finished, and released the C89 standard, more commonly known as ANSI C. In 1990 the International Organization for Standardization (ISO) adopted ANSI C (with a few minor modifications). This version of C became known as C90. Compilers eventually became ANSI C/C90 compliant, and programs desiring maximum portability were coded to this standard.

In 1999, the ANSI committee released a new version of C called C99. C99 adopted many features which had already made their way into compilers as extensions, or had been implemented in C++.


C++ (pronounced see plus plus) was developed by Bjarne Stroustrup at Bell Labs as an extension to C, starting in 1979. C++ adds many new features to the C language, and is perhaps best thought of as a superset of C, though this is not strictly true (as C99 introduced a few features that do not exist in C++). C++’s claim to fame results primarily from the fact that it is an object-oriented language. As for what an object is and how it differs from traditional programming methods, well, we’ll cover that in chapter 8 (Basic object-oriented programming).

C++ was standardized in 1998 by the ISO committee (this means the ISO committee ratified a document describing the C++ language, to help ensure all compilers adhered to the same set of standards). A minor update was released in 2003 (called C++03).

Three major updates to the C++ language (C++11, C++14, and C++17, ratified in 2011, 2014, and 2017 accordingly) have been made since then, each adding additional functionality. C++11 in particular added a huge number of new capabilities, and at this point is widely considered the new baseline. As of the time of writing, C++20 is in the works, promising to bring even more new capabilities. Future upgrades to the language are expected every three or so years.

Each new formal release of the language is called a language standard (or language specification).

C and C++’s philosophy

The underlying design philosophy of C and C++ can be summed up as “trust the programmer” -- which is both wonderful and dangerous. C++ is designed to allow the programmer a high degree of freedom to do what they want. However, this also means the language often won’t stop you from doing things that don’t make sense, because it will assume you’re doing so for some reason it doesn’t understand. There are quite a few pitfalls that new programmers are likely to fall into if caught unaware. This is one of the primary reasons why knowing what you shouldn’t do in C/C++ is almost as important as knowing what you should do.

Q: What is C++ good at?

C++ excels in situations where high performance and precise control over memory and other resources is needed. Here are a few common types of applications that most likely would be written in C++:

  • Video games
  • Real-time systems (e.g. for transportation, manufacturing, etc…)
  • High-performance financial applications (e.g. high frequency trading)
  • Graphical applications and simulations
  • Productivity / office applications
  • Embedded software
  • Audio and video processing

Q: Do I need to know C before I do these tutorials?

Nope! It’s perfectly fine to start with C++, and we’ll teach you everything you need to know (including pitfalls to avoid) along the way.

Once you know C++, it should be pretty easy to learn standard C if you ever have the need. These days, C is mostly used for niche use cases: code that runs on embedded devices, when you need to interact with other languages that can only interface with C, etc… For most other cases, C++ is recommended.

0.4 -- Introduction to C++ development
0.2 -- Introduction to programming languages

212 comments to 0.3 — Introduction to C/C++

  • ...
    Three major updates to the C++ language (...) have been made since then, each adding additional functionality to the language.

    after comma: "each has additional functionality."?

    PS: My thanks to author for the great pic.

  • Vitaliy Sh.

    C and Unix

    "Unix" (once) vs "UNIX" (3 times) there

    Sires, i found that the following sites:
    are using "Unix" as a default naming.

    I think that is because the "UNIX" trademark is a property of some people, while "Unix" is a mere "brand" and free-4-use.

  • Vitaliy Sh.

    "platform (hardware and operating system)"

    <span class="cpp-definition"> there?

  • This is really good to see about the introduction of c++. I want to say if anyone starts learning c++ then they must go through this blog once. The article is so much informative in nature and it's really helpful for everyone.

  • Dwayne Harris


  • Benji

    Do you really drive a Nascar?

  • Deepak Budha

    Just getting started!

  • C.S.R.B.

    My limited programming experience is from C and Pascal, So I don't think I'll have too much trouble with C++, especially thanks to this site. Seems pretty thorough and comprehensive, just how I like it. Thanks!


    After i learn c++ should I learn how to reverse engineer because I wanna make cheats for roblox
    like Synapse X.

  • Felipe

    hello, will this help me to start programming game hacking? Thank you.

  • Sudesh Chaudhary

    Hey, I know C and Python and I want to learn C++ for competitive programming. Is this site has enough material for me?

    • You'll need everything that's shown here, but it's not enough. You should know the standard library, especially <algorithm>.
      Depending on the subject and rules of the competitions, you'll also want to take a look at some 3rd party libraries.

  • amam

    can I learn c++ on my own with this website through I have no idea on c++ before but somewhat on c.

  • Dee

    I want to learn c++ for use at *modern* companies. Do you still recommend starting at c++98? If so, why? Would it be OK to start at c++11 or even more recent versions? Should I make sure to learn a certain version even if I don't start there?

    • I'm not sure what you mean with "start at C++X". The versions are built on top of each other, if you know C++20, you know C++98 (With some exceptions).
      You can't understand the change log of a modern C++ version without knowing its predecessors.
      You need to either read a full C++ tutorial that's already using the latest version, or read a tutorial that's using an old version (learncpp is using C++11) and once you finished that, read through the changes of the versions after.

      > Should I make sure to learn a certain version even if I don't start there?
      You should always keep up with the latest version (Currently C++17, C++20 is on its way).

  • Ajax

    I've never programmed before. Someone online makes aim assist for video games and says that he uses C++. I am trying to go a similar route. Is this something that I can learn or should I come back to C++?

    • You can write external cheats with any language you like. If you want to go internal, which gives you a lot more freedom of what you can do, you need C or C++ (There are others, but these are the best suited).
      You can't write a cheat without knowing how to program. You have to have a solid understanding of a programming language of your choice and assembly. If you don't know math, learn math. Especially trigonometry.
      Once you know a programming language, assembly, and math, i suggest you to start with a radar followed by an aimbot. Those are the easiest.
      You can plan on spending a good 2 years before you're able to write a decent cheat on your own.
      Start with a game that was written in C and (partially) leaked, eg. Call of Duty. Those are easier to understand.

  • Ritchie's essential objectives were to create a moderate dialect that was anything but difficult to accumulate, enabled effective access to memory, delivered productive code, and was independent. For an abnormal state dialect, it was intended to give the software engineer a considerable measure of control, while as yet promising stage autonomy (that is, the code didn't need to be changed for every stage).

  • Hi Alex!

    "C++ excels in situations where high performance and precise control over when memory and other resources are used is needed"
    I guess that should be
    "C++ excels in situations where high performance and precise control over memory and other resources is needed"

  • shirish

    is java easy like this???

  • Samira Ferdi

    what is platform-independent?

    • The platform the code is compiled/ran on doesn't matter.
      Platform independent code runs on linux/mac/windows/whatever and behaves the same.
      Sometimes you need to use features provided by your operating system, eg. creating a window. To use these features you need to use OS specific headers and libraries and your code no longer works on other systems until you make it compatible.

  • Musa

    I love this site

  • David Varner

    I know that the last thing a beginner should even think about doing is putting together a full-on software, but I'm planning on making something that resembles a digital audio workstation (GarageBand, Pro Tools, FL Studio and Logic Pro X are all DAWs) and was wondering what I would need to learn in addition to this course. A big part of a DAW is compatibility with third party plug-ins, which come in VST or AU format. There aren't many learning resources on VST and I would appreciate any advice on where to start and any simpler programs I should try making before doing something as big as creating a DAW.


    • nascardriver

      Hi David!

      * GUI and audio IO (Qt)
      * Various audio file formats
      * Writing compilers (For your plugins)
      * MIDI
      * Multi threading and async tasks

      Are the first things that come to my mind, all of them can be made easier by using third-party libraries, I don't know how much you want to do on your own. What you're talking about could take an experienced programmer several years, this is a big project.
      learncpp teaches C++ without specializing on a goal, you can use the tutorials here no matter what your goal is.
      There are tasks in every couple of lessons which ask you to write small programs. After finishing the tutorials here I suggest you starting by writing native plugins for the DAWs you described above to get an understanding of how they work.

    • Maxime

      You might want to take a look at how audacity is built to give you an idea of how a DAW is built. It is of course not as complete as other commercial DAWs but it is open source and has been around for a while.

    • Joel Keohane

      Hey David, I'm a beginner with a similar end goal (well, more focused on effect plugins in my case) and also a music producer. If you read this and would like to stay in touch, you can contact me through
      discord: Inferno#7176 (you can also find me as a moderator on the FL Studio server)
      Sorry if this is coming off as too forward, but I think it would really be cool to talk to someone with a similar goal
      P.S. have you checked out JUCE? It is for creating audio applications using C++

      • David Varner

        Hi Joel,
        I've sent you a friend request on Discord, and would be happy to keep you up to date on any progress I make on my DAW (Or any other audio software projects).
        Please keep in mind that I am still far from completing the C++ course and that the DAW is more of a long term goal so I probably won't get much done quickly.

        And yes, I have had a look at JUCE but didn't know how to use it :D (Which is why I'm doing this course). I plan on using it as soon as I know a bit more about C++.

        I look forward to hearing from you,

  • Matt

    Hello Alex,

    I've got question concerning following part of text: "...extensive run-time suport...".

    Could you provide simple explanation, what do you mean by that?

    Thanks in advance,

    • nascardriver

      Hi Matt!

      Take C# for example. To run a C# program you need to have the .net framework installed.
      A C++ program on the other hand can run on an out-of-the-box system.

  • Kartikeyn

    What is the diff. between object oriented programming and functional programming? And advantages and disadvantages of both.

  • Chris

    Thank you! i must say this very well written or dare i even say beautifully written and more importantly easy to digest once again thanks for taking the time to do so!

  • William Osler

    Very well-written. Thank you for providing this.

  • Aman

    I have not any experiene from  cpp bu now im a starter and learner wish me the best <3


  • Kais

    Hi Alex,

    I want to ask you what ISO/IEC are? what do they do in C++?

  • Asif Zardari

    Nice information keep it up*

Leave a Comment

Put all code inside code tags: [code]your code here[/code]