Skip to content

Instantly share code, notes, and snippets.

@sojohnnysaid
Last active January 19, 2021 22:51
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/2c9fe197b370c15150d36df191e69864 to your computer and use it in GitHub Desktop.
Save sojohnnysaid/2c9fe197b370c15150d36df191e69864 to your computer and use it in GitHub Desktop.
#include <stdio.h>
#include <cs50.h>
string order_turkey(string);
int main(void)
{
// And example of scope and passing by value
// This code passes a variable by value
// Because we don't store the variable returned
// We can't use it in main()
string meat = "ham";
printf("You ordered a %s and cheese sandwich\n", meat);
order_turkey(meat);
printf("You ordered a %s and cheese sandwich\n", meat);
}
string order_turkey(string m)
{
m = "turkey";
return m;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment