passing variables between functions
Hi all!
As a newbie I try to dig into every basic problem to learn the proper way of programming, instead of make a work-around. My question is: Why is the choice-variable not passed in a proper way? The second time it's printed a very weird number is diplayed
Code:
#include <stdio.h>
int Menu(int choice)
{
printf("enter a number: ");
scanf("%d", &choice);
printf ("Choice is: %d\n", choice);
return choice;
}
int main(void)
{
int choice;
Menu(choice);
printf ("Choice is: %d\n", choice);
return 0;
}
Thanks in advance for answer