G
gk245
I have something like this:
struct block
{
int x;
int y;
float z;
}
void somefunction (struct block next[])
{
int i;
for (i =0, i < 4, i++)
{
printf("%i", next.x)
}
}
main()
{
// arrary of initialized structure.
somefunction(initialized structure)
}
Well, somefunction won't work. It just keeps saying that it can't
access the members x, y or z (depending on which one is being printed
out). I can't figure out why. I mean, it seems like i did it right,
since i delared a structure first, then made a variable of that type
and passed it to the function. Then i initialized the structure in
main, and passed that to somefunction.
Thanks.
struct block
{
int x;
int y;
float z;
}
void somefunction (struct block next[])
{
int i;
for (i =0, i < 4, i++)
{
printf("%i", next.x)
}
}
main()
{
// arrary of initialized structure.
somefunction(initialized structure)
}
Well, somefunction won't work. It just keeps saying that it can't
access the members x, y or z (depending on which one is being printed
out). I can't figure out why. I mean, it seems like i did it right,
since i delared a structure first, then made a variable of that type
and passed it to the function. Then i initialized the structure in
main, and passed that to somefunction.
Thanks.