Hello
I wrote a program where I used pointers to point to a structure within a function.
Code:
typedef struct{
float Fish;
float Cotton;
float Wood;
float Coco;
float Sugar;
float Guns;
float Textiles;
float Tobacco;
float Wine;
}Goods_g;
But the problem is that I did calculations in a different function and assigned each element in the structure a value.
Code:
int DisplayPort(Goods_g *G, float variables[])
{
G->Fish = 50*variables[0];
G->Cotton = 80*variables[1];
G->Wood = 100*variables[2];
G->Coco = 140*variables[3];
G->Sugar = 350*variables[4];
G->Guns = 700*variables[5];
G->Textiles =1350*variables[6];
G->Tobacco =1900*variables[7];
G->Wine =2150*variables[8];
}
I want to use the values assigned to the elements in this function in another function. I don't know how to do so. Any help would be appriciated.