Skip to content
devnekPublic

About

Notes for CPP

Resources

Stars

0 stars

Watchers

1 watching

Forks

Repository files navigation

C/C++ Programming

Author: Deva Nayak

A collection of C/C++ programming notes, examples, and exercises.

Table of Contents

Chapter Topic Link
1 Introduction & First Program chap1/chap1.md
2 Header Files chap2/chap2.md
— Compilers Overview compilers/compilers.md
— Optimization Techniques Optimization/Optimization.md
— Multithreading Multithreading/Multithreading.md
— Virtual Functions virtualFunctions/
— Python & Virtual Environments python/python.md

Quick Compile Commands

Prerequisites

On macOS you already have clang/clang++ via Xcode Command Line Tools. For CMake:

brew install cmake

Chapter 1 — First Program (C)

cd chap1/code
gcc firstProgram.cpp -o firstProgram
./firstProgram

Chapter 2 — Header Files Exercise (C)

cd chap2/code
gcc main.c math_operations.c -o program
./program

Multithreading (C++11)

cd Multithreading/code
clang++ -std=c++11 -pthread Multithreading.cpp -o multithreading
./multithreading

Optimization — Loop Unrolling (CMake)

cd Optimization/code
mkdir -p build && cd build
cmake ..
make
./loop_unrolling_example

Virtual Functions Examples (CMake)

Each sub-folder under virtualFunctions/ has its own CMakeLists.txt:

# Example: build the "code" example
cd virtualFunctions/code
mkdir -p build && cd build
cmake ..
make
./notvirt

Available examples:

Folder Executable
code/ notvirt
codeV2/ notvirt
statfunc/ statfunc
virtpure/ virtpure
virtpers/ virtpers
graphics/ virtshap

Quick one-liner to build any CMake project

cmake -S <source-dir> -B <source-dir>/build && cmake --build <source-dir>/build

Example:

cmake -S virtualFunctions/code -B virtualFunctions/code/build && cmake --build virtualFunctions/code/build

About

Notes for CPP

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages