Skip to content

Instantly share code, notes, and snippets.

@sojohnnysaid
Last active January 19, 2021 22:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save sojohnnysaid/74baaca98edebd5cc192749148b6424b to your computer and use it in GitHub Desktop.
Save sojohnnysaid/74baaca98edebd5cc192749148b6424b to your computer and use it in GitHub Desktop.
#include <stdio.h>
#include <cs50.h>
void my_function();
string global = "SUPERMAN!"; // global is SUPERMAN and has access to all scopes
int main(void)
{
global = "FLASH"; // global is FLASH
my_function(); // global is BATMAN
printf("the global variable is %s\n", global); // global is BATMAN
}
void my_function()
{
global = "BATMAN!";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment