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/c2a70c644d57f4defcb4344712834ad9 to your computer and use it in GitHub Desktop.
Save sojohnnysaid/c2a70c644d57f4defcb4344712834ad9 to your computer and use it in GitHub Desktop.
#include <stdio.h>
#include <cs50.h>
string order_turkey(string);
int main(void)
{
// This version solves the previous issue from variable_scope_1.c
// We assign the returned value of our order_turkey function
string meat = "ham";
printf("You ordered a %s and cheese sandwich\n", meat);
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