[英]How to return the address of inner struct given pointer to outter struct in c
How can I return the address of the target if i have the following struct and the prototype for the function is also as follows如果我有以下结构,我如何返回目标的地址,function 的原型也如下
struct inner{
int foo;
};
struct outter{
struct inner innerStruct[100];
};
struct inner * foo1(int target){
}
NOTE** I don't need the algorithm to find the target, I just want to know how to return the address of the target if found.注意**我不需要算法来找到目标,我只想知道如果找到了如何返回目标的地址。
If out
is a pointer to a struct outter
, then out->innerStruct
is the array innerStruct
inside that structure, and out->innerStruct[i]
is element i
of that array, and &out->innerStruct[i]
is the address of that element.如果
out
是指向struct outter
outter 的指针,则out->innerStruct
是该结构体内部的数组innerStruct
, out->innerStruct[i]
是该数组的元素i
,而&out->innerStruct[i]
是那个元素。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.