Skip to content

Instantly share code, notes, and snippets.

@jeffcrouse
Created October 11, 2013 14:28
Show Gist options
  • Save jeffcrouse/6935608 to your computer and use it in GitHub Desktop.
Save jeffcrouse/6935608 to your computer and use it in GitHub Desktop.
#include <iostream>
using namespace std;
int foo; // static memory allocation
void f()
{
int bar; // automatic memory allocation
cout << "&bar = " << &bar << endl;
return;
}
int main ()
{
cout << "&foo = " << &foo << endl;
f(); // "bar" is *automatically* allocated and released
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment