So I am creating this program to make a receipt. Keep in mind that the program is nowhere near done, this is just the basic shell of the program, with little, very little content. So the problem is that I made a function that makes the receipt and prints it out, however it uses variables from the main() function. So to use them I declare them globally right? But when I do, the value is printed out at 0, no matter what value I give it in the main function....why is that?
The first thing I noticed is that you have itemcost defined twice. Once as a global variable, and again as a local variable. Try removing the local definition, as it is likely that main is using the local variable while receipt is using the global variable.
Another thing you can do is instead of using a global variable, which is typically looked upon as very bad practice, pass the value as a function argument.