Skip to content

Instantly share code, notes, and snippets.

@rpivo
Last active December 11, 2020 14:24
Show Gist options
  • Save rpivo/3139a09477c8df7fbe81d403c3bc3feb to your computer and use it in GitHub Desktop.
Save rpivo/3139a09477c8df7fbe81d403c3bc3feb to your computer and use it in GitHub Desktop.
const in C++

const in C++

In C++, we can declare a value as immutable by using the const keyword, which is similar to const in JavaScript.

bool isVowel(const char p_char) { ... }

Unlike JavaScript, we can label incoming arguments with const, indicating that they won't undergo any mutation throughout the function.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment