B
Borealis
Hi,
this might be a silly question but I really got stuck here.
Suppose I have:
struct A {
int a;
int b;
int c;
};
struct B {
int x;
int y;
struct A z;
}
struct B params[2];
void doSomethingWithParams(struct B* arg)
{
/* Do something with parameters */
}
void main(void)
{
doSomethingWithParams(params[1].&z);
}
The function-call in main does not work. I get an error: expected a
field name
Is this a limitation of the c language? Is it not possible to get the
address of struct in struct? What would be a alternative to this? I
know I could have static variables for z and assign it as a pointer to
params (with struct A* z in B). But this does not hold relevant
information at one point then...
Thanks for your tips and hints!
this might be a silly question but I really got stuck here.
Suppose I have:
struct A {
int a;
int b;
int c;
};
struct B {
int x;
int y;
struct A z;
}
struct B params[2];
void doSomethingWithParams(struct B* arg)
{
/* Do something with parameters */
}
void main(void)
{
doSomethingWithParams(params[1].&z);
}
The function-call in main does not work. I get an error: expected a
field name
Is this a limitation of the c language? Is it not possible to get the
address of struct in struct? What would be a alternative to this? I
know I could have static variables for z and assign it as a pointer to
params (with struct A* z in B). But this does not hold relevant
information at one point then...
Thanks for your tips and hints!