0.1 — Introduction to these tutorials


    Welcome to the Learn C++ tutorials! Above all else, these tutorials aim to make learning C++ easy.

    Unlike many other sites and books, these tutorials don’t assume you have any prior programming experience. We’ll teach you everything you need to know as you progress, with lots of examples along the way.

    Whether you’re interested in learning C++ as a hobby or for professional development, you’re in the right place!

    Lesson structure

    The lessons in this introductory chapter are aimed at giving you some context around what C++ is, how it came about, how programs work, and what software you need to install to create your own programs. You’ll even write your own first program.

    Further chapters will explore different parts of the C++ language. In the first chapter (chapter 1), you’ll get a broad but shallow overview of many fundamental C++ concepts, so we can start writing some simple programs. Further chapters will explore those concepts in depth, or introduce new concepts.

    Each chapter has a theme, with all of the sections underneath it being generally related to that theme. There is no suggested amount of time that you should spend with each lesson or chapter; progress through the material at a pace that is comfortable for you.


    Before we get started, lets hit on a couple of important goals of these tutorials:

    • Cover programming topics as well as C++. Traditional textbooks do a pretty good job of teaching the basics of a given programming language, but they often do not cover relevant programming topics that are incidental to the language. For example, books will omit sections on programming style, common pitfalls, debugging, good/bad programming practices, and testing. Consequently, by the time you finish the book, you may understand how to program in a language, but you might also have picked up bad habits that will come back to bite you later! One of the goals of these tutorials is to make sure that all of these incidental topics are covered along the way, in the sections where it naturally makes sense to discuss them. When you finish, you will not only know how to program in C++, you will know how NOT to program in C++, which is arguably as important.
    • Provide a lot of examples. Most people learn as much or more from following the examples as they do from reading the text. These tutorials will endeavor to provide plenty of clear, concise examples to show how to apply the concepts you are learning. We will also avoid (as much as possible) the twin evils: the magic hand wave (also known as ), where in the interest of space part of an example is omitted, and the unexplained new concept, where a new concept that is integral to the example is introduced without any mention of what it is or how it works. Both of these tend to lead to getting stuck.
    • Provide practice programs. The end of many lessons and sections will contain some exercises that you can attempt to answer on your own, along with solutions. You can compare your solution against ours to see what we did differently, or, if you get stuck, how we solved the problem. Then you can go back and refocus on the areas you need more work on.
    • Most importantly: have fun. Programming can be a lot of fun, and if you’re not generally having fun, you’re not in the right mindset to be programming. Tired or unhappy programmers make mistakes, and debugging code tends to take much longer than writing it correctly in the first place! Often you can save yourself some time by going to bed, getting a good night’s sleep, and coming back to a problem in the morning.

    Getting the most out of these tutorials

    As you go through these tutorials, we recommend a number of practices to maximize your learning experience:

    • Type in the examples by hand and compile them yourself. Do not copy and paste them! This will help you learn where you commonly make errors, as well as becoming familiar with compiler warnings and errors. Don’t just transcribe the programs mindlessly -- think about what each of the lines you are typing in does, and how it contributes to the way the program functions. If you encounter anything that doesn’t make sense, or that you don’t understand, that’s something to investigate further.
    • As you make mistakes or find bugs in your programs, fix them. Try to solve your own problems before asking others for help. Learning how to find and fix errors is a key skill to successful programming. Don’t neglect learning how to use a debugger (we’ll explain how in a future lesson) -- it’s a key tool in figuring out where your programs are going wrong.
    • Experiment with the examples. Change numbers and text to see what happens. Modify the programs to do additional things (e.g. if a program adds two numbers, make it add three numbers). Try to find different ways to break the programs (if a program asks for user input, try a variety of different inputs). You’ll learn more by modifying the examples than by simply following them.
    • Plan to spend some time with the quizzes. If you’re new to programming, you may find these challenging (and that’s normal, as your brain acclimates to the programming mindset). Don’t be discouraged if you don’t get the right answer the first time. You may need to try several different approaches before you find a path to success. It’s okay to look at the answer if you’re really stuck. Just make sure you understand how the provided answer works before proceeding.

    • Write your own short programs using the concepts you have learned. Nothing is better than practice.

    Common site-related questions

    Q: How do I sign up for the site? How do I get a login?

    All parts of this site are accessible anonymously -- therefore, no user account or signup is needed!

    Q: These tutorials were originally written in 2007. Are they still relevant?

    Yes, absolutely.

    C++ doesn’t change very often, and when it does, the new content is largely additive. The tutorials have also been updated periodically based on language changes and readers’ feedback.

    Q: Is there a PDF version of this site available for offline viewing?

    Unfortunately, there is not. The site is able to stay free for everyone because we’re ad-sponsored -- that model simply doesn’t work in PDF format. You are welcome to convert pages from this website into PDF (or any other) format for your own private use, so long as you do not distribute them.

    Q: What should I do if I get stuck on a concept?

    If you don’t understand something:

    • Read through the comments. Other readers may have encountered similar challenges.
    • Scan through the next lesson in the series -- your question may be answered there.
    • Use a search engine to see if your question (or error message) has been addressed elsewhere.
    • Ask your question on a site that is designed for programming Q&A, like Stack Overflow.

    If all else fails, skip the material you don’t understand, and come back to it later. You may find that something that was hard to understand is easier with the additional knowledge and context provided by other articles.

    Q: What do I do if I forget what something means?

    Use the Site index. Look up any topics you want to know more about there, and you’ll find links to the lessons where that topic is discussed.

    Q: How do I get an avatar for the comment section?

    The comment section uses gravatars. You can create one on Click the “Create your own gravatar” button and sign up. Your gravatar will be connected to your (optionally provided) email address.

    Q: Can you do a dark mode for this site?

    Not easily, but you can! See

    Finally, one small nag: This site is free because it is ad-supported. If you find yourself enjoying the lessons, please consider disabling your ad blocker.

    Alright, let’s get on with it!

    0.2 -- Introduction to programming languages
    No previous lesson

521 comments to 0.1 — Introduction to these tutorials

  • Awe

    Good place!
    But it's hard for me!
    My English is not very good!

  • Tyler S.


    Thank you for taking the time to create this website. I've always wanted to learn to code, particularly in C++ as I hope to help create games.

    I am 25 years old and have tried to pick it up multiple times but every book, site and tutorial I've attempted is always too complex in their explanation and assumes that I know what some of the basics are.

    To have a resource that is completely free and breaks down the most fundamental elements of the process is absolutely astounding and I couldn't be more grateful for your efforts.

    Thank you, a million times, thank you.

    • Alex

      You're welcome. Thanks for visiting!

      • Shortcuter4

        Hello Sir,

        Is there any other website that you created for other languages, or for different concepts?
        I am grateful to your work and really appreciate your effort!


        • Alex

          Nope, this is the only one. :)

          • OpenToLearnNewStuffs


            I will look at this tutorials in the break time between semester. I learnt Java for 1 year. C++ will be new language for me and as far as I know, it is different from Java. Is "pointer" well/wide explained here or shall I find extra info. somewhere else? I am asking it, because I think that is one of the most major concept of C++ which I need to understand fully.

            I hope, I will be fully ready for the next semester at the end of these tutorials. Looking forward to learn this in winter break.

  • sebastian

    Hi, thanks for this material.Can I get solid knowledge about c++ doing all the tutorial?or ,will I need to search fot other sub-topics?

    • Alex

      You'll get a solid knowledge of the core fundamentals. This tutorial series does not comprehensively cover the standard library, so you will need to supplement with information on that if you want to learn more. But the core fundamental knowledge is a prerequisite for other kinds of knowledge, so you might as well start here.

  • Anthony

    Since this is not near 2017, is it still workable? Or is there areas it won't work out?
    Would it be a bad idea for me to learn how to do this with ADHD?
    What 4 types of programs can I make with this site?

    Still props to you for this website!
    Sorry for wasting your time!

    • Alex

      These tutorials have largely been kept up to date. I can't speak to your learning capabilities. You could try and see how far you get. You can make all kinds of programs with this site, but we're focused on console applications since those are cross-platform compatible. Once you complete these tutorials, you'll be well set up to go learn about other things (including graphical applications).

      • Anthony

        Thank you a lot! I never thought you would reply, but I guess I was wrong.
        Have a nice Christmas if you celebrate it, even if you don't, then happy holidays!

  • AshokChoudhary

    I want to learn

  • Vivek Tamang

    How should i register for this site of yours ?

  • Virtuous

    I love how the site has been here for 10+ years. Hats off to you, mate. Time to crack the code.

  • Dekasi

    Hi Alex! I love your tutorials and the way you explain things, especially how C++ works under the hood. I started t learn Java and I have problem understanding how it works. I tried to find some tutorials with extensive explanations, but I didn't find any. Do you have a similar tutorial for Java, or if you don't can you share some sources that you find useful for Java?
    Thank you so much Alex for this amazing tutorial!!!

    • Alex

      I don't have any Java tutorials, nor am I aware of anything similar. I've heard the Head First Java book is decent, but I haven't seen it myself.

  • nayoni

    Can I convert this site in to my new app which contains c++ Tutorials sites. If you ok with that please tell me (if there any grammar mistakes sorry for my English)thanks!

    • Alex

      You are welcome to link to this site from within your app. However, I'd ask that you please do not copy the article content (or a derivative of the content, such as a translation) into your app. Thanks!

  • Balj

    Hello, sir. You're very generous person.
    These tutorials are very easy to follow despite not being dumbed down.
    BTW is there any recommended sites to exercise after chapters?
    Or are planning to add exercises after every section?

    • Alex

      There are no recommended sites after finishing the tutorial currently. There are exercises after most sections that would benefit from them, plus the end of the chapter comprehensive quiz.

  • Mahmud

    Whoever is the good samaritan who made this IMMENSELY useful website, I want to say THANK YOU! THANK YOU from the core of my heart. I have gone through books, went through numerous online courses just to understand what functions are actually doing in the background, how actually variables are being handled.....the resources were either too basic to answer my questions or too esoteric for my understanding. It is ONLY in here I get a straight to the point but yet detailed answer of my queries. So, THANK YOU again. Keep up the good work!

  • NO_ Name please

    Happy to find this website, never seen such site truly dedicated to teach programming so efficiently.
    Thank you Admin

  • Aleksander

    I've read almost everything on learncpp, and I can now say it's the easiest material on C++ ever written. An ape could have understand C++ using this site. I've tried with many books, with no succes, until now. Really, consider realising this stuff in a book form. My best regards.

  • 7EX1U5

    This is by far the most descriptive tutorial I've come across, period. Not just for C++ but just anything. Written ten years ago but still relevant, that's just in another league man. I've gone through at least three other C++ tutorials but was never confident enough to think that they gave me enough knowledge for me to consider myself learned in the language, because they just weren't descriptive and thus long enough.

  • Ush


  • Cody

    Hey Alex! Do you have a website/set of tutorials for learning C as well!?  These have been so good I want to see if you have other tutorials, especially since i need to learn C now :)

  • Gabriel

    Cool Tutorial, exactly what I was looking for!

  • Amir

    I'm reading the contents of the chapters! You've done a great job really!

    I had a question, do you like to make a book from your website? maybe you can publish the paper version or put the pdf version of it?

    I think that would be really great! anyway Thank You Alex : ))

  • Cornel Ciky

    Thank you so much for creating this website.

    i greatly appreciate the clear explanations and the way the lessons are organised (e.g. the quizzes are a great way to remember all the neat tricks learned in the specific chapters).

    i have learned so much. is by far the best c++ tutorial i have found so far.


  • A guy

    Oh right. I should turn off adblock on his website. Thanks for the reminder.

  • Yash

    I m new .....hope to learn soon

  • Giti

    Hi alex. Your website is awesome. Can you introduce a site for learning java , to me?

  • I hope learn c++ better here

  • Quack_s

    wow what a nice site man

  • Holy, written ten years ago and still in maintenance! You guys rock!

  • lolohol

    what are pointers

  • talha shaikh

    i want to make apps in c++
    where to learn
    plzzzzz tell me and isyour programming tutoril required to make apps

  • Stratacos

    Where can I find a free compiler that uses green text on a black background, like in the old days?

    • Alex

      Many IDEs will let you customize the color of the text and background. You should be able to do this with Visual Studio or Code::Blocks.

  • Minakshi

    What platform I need to c++ I have an windows laptop

  • Shahmeer

    is there any c++ compiler which can be used for practice purposes?

Leave a Comment

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