A curated collection of small C++ programs and demo projects exploring core language concepts, data structures, memory management, file I/O, multithreading, and FFI with Python. The repo is primarily C++ with a small amount of Python.
This repository collects small, focused examples created while learning and practicing modern C++. Examples are intentionally compact and well-commented so you can run, tweak, and learn quickly.
- Hands-on examples for OOP, data structures, file handling, memory management, multithreading, templates (in progress), and more.
- Python helper scripts and FFI examples demonstrating C++ ↔ Python interoperability.
Locate the .cpp file you want to run (for example examples/foo.cpp) and compile:
# compile
g++ -std=c++17 -O2 -Wall path/to/example.cpp -o example
# run
./exampleAdjust -std to match the example (e.g., -std=c++11, -std=c++17) if required.
If a folder includes CMakeLists.txt, use CMake:
mkdir -p build && cd build
cmake ..
cmake --build .
# run binaries from build/If no CMakeLists.txt exists, build examples individually with g++ as shown above.
Some examples include Python utilities or FFI demos:
# run a Python script
python3 scripts/example.py
# if requirements provided
python3 -m pip install -r requirements.txt
python3 demo.pyTypical folders in this repo:
basic-concepts— syntax, I/O, control flowoop-concepts/custom-header-class— classes, headersdata-structures— lists, stacks, queues, STL demosmemory-management— pointers, RAII, smart pointersfile-handling— file streams & parsing examplesmultithreading— threads, mutexes, concurrency examplesCpp-foreign-function-interfaces/Cpp-Python-FFI-with-Pybind11— FFI examplesREADME.md— this file
Refer to each folder for its own notes and examples.
Contributions welcome — keep examples small, focused, and well-commented.
- Fork the repo
- Create a branch:
git checkout -b feature/<topic> - Add your example(s) and a short README or comments
- Commit, push, and open a Pull Request
This project is licensed under the MIT License — see the LICENSE file for details.