Skip to content

Instantly share code, notes, and snippets.

@sojohnnysaid
Created February 16, 2018 12:10
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/d737309b3300819182f009e27663c926 to your computer and use it in GitHub Desktop.
Save sojohnnysaid/d737309b3300819182f009e27663c926 to your computer and use it in GitHub Desktop.
#include <stdio.h>
#include <cs50.h>
string my_function(string s);
string global = "SUPERMAN!";
int main(void)
{
// Passing global as an argument
// changes the output because
// we are passing by value.
global = "FLASH";
my_function(global);
printf("the global variable is %s\n", global);
}
string my_function(string s)
{
s = "BATMAN!";
return s;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment