I am begginr programmer wiyh C. I want to do a work with structure variables, but I don't know how. Could anyone help me?
I have to define a structure variable like bellow:
struct name{
int x;
int y;
}NAME;
I creat some NAME[i] within a loop and set "x" and "y" for all of them (for example 100 NAME[i]). I must also add that the "y" is a unrepeatable number and in all NAME[i] variales (i.e. there are 100 different "y"). After that I get a number (k) equal to one "y" of the NAME variables within another part of my code. I want with this number (k) get the related x (that its "y" is equivalent to this number).
My problem is that I don't know how can I do that?
Thanks in advance,
Cheers
I have to define a structure variable like bellow:
struct name{
int x;
int y;
}NAME;
I creat some NAME[i] within a loop and set "x" and "y" for all of them (for example 100 NAME[i]). I must also add that the "y" is a unrepeatable number and in all NAME[i] variales (i.e. there are 100 different "y"). After that I get a number (k) equal to one "y" of the NAME variables within another part of my code. I want with this number (k) get the related x (that its "y" is equivalent to this number).
My problem is that I don't know how can I do that?
Thanks in advance,
Cheers
Comment