Skip to content

Instantly share code, notes, and snippets.

@bunelr
Created February 19, 2016 16:59
Show Gist options
  • Save bunelr/d211af99bc493af1d6e4 to your computer and use it in GitHub Desktop.
Save bunelr/d211af99bc493af1d6e4 to your computer and use it in GitHub Desktop.
Const behavior
#include <iostream>
void test_const( int & a, const int & b){
a = a + 1;
a = a-b;
}
int main(int argc, char *argv[])
{
int a = 2;
test_const(a, a);
std::cout << a << '\n';
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment