Git Product home page Git Product logo

cpp-tutorial's Introduction

C++ Tutorial ๐Ÿ’ป ๐Ÿ’พ

Learn C++ in one evening with this brief yet straight to the point tutorial.

About this repository

We divided the repository is sections starting from 00_hello_world. Each of the sections will teach you gradually the syntax of C++, from zero to (almost) hero. Drop a โญ๏ธ if you found it helpful!.

Compile and run the examples

Choose and install your favorite C++ compiler (I will use g++). If you wish to learn how to compile your code visit this links if you are a Window, Linux or MacOS user. Then compile and execute the output binaries, here's what I do to run the first hello world example:

cd 01-hello-world
g++ 00_hello_world.cpp

Finally, we can execute the binary as:

./a.out

How compilation works

According to this helpful resource, the compiler goes through the following 5 steps:

  1. Pre-processing: First, the pre-processor reads the source code and performs macro expansions, inclusion of header files, and other operations as specified by pre-processor directives (#include, #define, #ifndef, etc.).
  2. Compilation: Second step performs the actual translation of the source code into object code. The object code is a machine-readable representation of the source code, but it is not yet executable.
  3. Assembly: The compiler then passes the object code to an assembler, which converts the object code into assembly code.
  4. Linking: The linker then combines assembly code with any library functions that are required by the program and resolves any references to external symbols/libraries. The linker produces an executable file to run on the target platform.
  5. Execution: Finally, the compiler produces and executable file that runs on the computer system.

cpp-tutorial's People

Contributors

aavache avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.