hello !
i have a program id like to code , and it uses from 3 upto 15 members of a structure , id like to ask ,
1,
is there a way to not define all members of a structure at the start but add members as needed ?
2,
im fairly sure im missing something out , im sure theres a better way to add 15 members to a structure than this , but i cant remember ?
struct jatekos ja1,ja2,ja3,ja4,ja5,ja6,ja7,ja8,ja9,ja10,ja11,ja12,ja13,ja14,ja15;
3,
the following code isnt working because of the
strcpy(tmp,ja.nev)
what can i do to tell the program to work with "ja1" struct member ? and after that "ja2" .. and the number after the "ja" would always be the value of "i"
like stings , for example
tmp[i]; i++;
... i want to increment that value !!
i know it doesnt work because its a different object/function altogether but is there a way to give a variable to C in this format ? where part of the variables name is a variable itself ?
struct jatekos
{
char nev[20];
int dob1;
int dob2;
int dob3;
};
struct jatekos ja1,ja2,ja3,ja4,ja5,ja6,ja7,ja8,ja9,ja10,ja11,ja12,ja13,ja14,ja15;
int x;
int i;
char tmp[20];
void main (void){
i=1;
printf("adja meg az %d. jatekos nevet ! ha vegzett , ures sor !",i);
while(getline(tmp,20)>0){
strcpy(tmp,ja[i].nev)
i++
}
getchar();