I Made All the modifications suggested but I'am having problems calling the function. I can'nt seen to make the function cal corectly. I want the array from the function variable to return it to function main so I can then pass it on to function Sydney.
Code:
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#define a 100
#define size 9
typedef struct{
float Fish;
float Cotton;
typedef struct{
char Sydney;
}Ports_p;
float variable(void);
int Sydney(Goods_g *G, float x[]);
int main()
{
Goods_g Goods;
Goods_g *G;
G= &Goods;
Ports_p Ports;
Ports_p *P;
P= &Ports;
char name[a];
int i;
int x;
x=1000;
float y;
printf("Please enter your name: ");
scanf("%s",&name);
printf("Please select which pont you want to start in: ");
scanf("%d",&i);
if(i==1)
printf("Welcome to Sydney\n");
if(i>1 || i<0)
printf("You must enter 1\n");
y = variable();
Sydney(G,*y);
return 0;
}
float variable(void)
{
int i;
float x[size];
srand((unsigned)time(NULL));
for (i=0; i<9; i++)
x[i] = (rand()%26)/14.0f;
return 0;
}
int Sydney(Goods_g *G, float x[])
{
G->Fish==50*x[0];
G->Cotton==80*x[1];
printf("Welcome to Sydney\n");
printf("The prices for the material is as follows\n");
printf("Fish==%f\n, G->Fish\n");
printf("Cotton==%f\n, G->Cotton\n");
return 0;
}