Hello I'am writing a program and I used structures to make some user defined variables. Then I passed those variables to another function where a value was assigned to them. Now I want the values of those variables to be used in another function. How do I do that?
Below is an example of what I did.
Code:
typedef struct{
float Fish;
float Cotton;
float Wood;
float Coco;
float Sugar;
float Guns;
float Textiles;
float Tobacco;
float Wine;
}Goods_g;
int main()
{
Goods_g G;
other parts of the program is written here
}
int function(Goods_g *G)
{
G->Fish = 50;
G->Cotton = 80;
G->Wood = 100;
G->Coco = 140;
G->Sugar = 350;
G->Guns = 700;
G->Textiles =1350;
G->Tobacco =1900;
G->Wine =2150;
}
int Another_Function()
{
how do I get the values of the individual elements sucn as Fish to use in this function without changing the values
}
I apologies for the vagueness of the question and the information that I provided but I want to learn how to do this. If any body can help me and point me in the right direction I will be very grateful.