Pointer in a C mex sfunction
显示 更早的评论
Hello,
I have some problems to understand the syntax and the meaning of some pointers used in a C sfunction For example taken the output method of the TimesTwo sfunction
From which I reported an extract hereafter
Int_T i;
InputRealPtrsType uPtrs = ssGetInputPortRealSignalPtrs(S,0);
real_T *y = ssGetOutputPortRealSignal(S,0);
int_T width = ssGetOutputPortWidth(S,0);
for (i=0; i<width; i++) {
/*
* This example does not implement complex signal handling.
* To find out see an example about how to handle complex signal in
* S-function, see sdotproduct.c for details.
*/
*y++ = 2.0 *(*uPtrs[i]);
}
}
what is it supposed to mean *y++ (is the value to which the y pointer refers, isn't? but I'm wondering why there is the ++ notation following *y, I thought it's to point to the next memory area because we deal with a static vector). Am I right?
And what does it means (*uPtrs[i])? I thought it was the value of the variable to which the pointer points to.
is there anyone, who can help me to figure it out? can you suggest me some good references to understand how this stuff works?
thanks for reading
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Automotive Radar 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!