Hi,
Im completely new here so please bear with me if I screw things up!
Basically I have a piece of coursework along the lines of making a football league program in C. Looks easy in theory but ive managed to confuse myself.
that is the struct ive created with what I believe are declarations for 12 instances of the struct.Code:typedef struct { char name[1][20]; int p,w,d,l,f,a,t; } team; team a = {1,0,0,0,0,0,0,0}; team b = {2,0,0,0,0,0,0,0}; team c = {3,0,0,0,0,0,0,0}; team d = {4,0,0,0,0,0,0,0}; team e = {5,0,0,0,0,0,0,0}; team f = {6,0,0,0,0,0,0,0}; team g = {7,0,0,0,0,0,0,0}; team h = {8,0,0,0,0,0,0,0}; team i = {9,0,0,0,0,0,0,0}; team j = {10,0,0,0,0,0,0,0}; team k = {11,0,0,0,0,0,0,0}; team l = {12,0,0,0,0,0,0,0};
Quite simply, I just cant figure out how to pass a struct into a function.
For example, I want to pass the struct team into a function which contains a for loop to read in 12 names...
As far as I can find out I need to pass in an exact defined struct for this to work, eg passing a or b. I cannot pass the struct 'team' and then set a.name to something or b.name to something.
Is this true or have I confused myself completely? or.. have I confused you all aswell?