Skip to content

Instantly share code, notes, and snippets.

@bradenmacdonald
Created May 21, 2017 11:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bradenmacdonald/e54e25452ee9dc0bbdb29a6388283b34 to your computer and use it in GitHub Desktop.
Save bradenmacdonald/e54e25452ee9dc0bbdb29a6388283b34 to your computer and use it in GitHub Desktop.
#include <iostream>
#include <string>
using std::string;
string name = "Alice";
void foo() {
std::cout << "Hello " << name << std::endl;
}
void bar() {
std::cout << "Hello " << name << std::endl;
string name = "Bob";
std::cout << "Hello " << name << std::endl;
}
int main() {
foo();
bar();
return 0;
}
// Output:
// Hello Alice
// Hello Alice
// Hello Bob
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment