Lesson 23 of 45 · C++
Lesson 3: Hello World and Basic Syntax
Duration: 6 min
Lesson 23 of 45 · C++
Duration: 6 min
#include, #define and other directives.\n2. Compilation – translating the cleaned source into assembly.\n3. Linking – combining object files and libraries into an executable.\n\n---\n\n## The canonical "Hello, World!" program\ncpp\n#include <iostream>\n\nint main() {\n std::cout << \"Hello, World!\" << std::endl;\n return 0;\n}\n\n\nKey observations:\n- The #include directive pulls in the iostream header.\n- int main() is the entry point.\n- std::cout writes to the standard output stream.\n- std::endl inserts a newline and flushes the buffer.\n\n> Tip: Try compiling with g++ -std=c++20 -Wall -Wextra hello.cpp -o hello to see warnings that help you write safer code.\n\n---\n\n