[英]warning: passing argument 2 of 'calcFx' makes integer from pointer without a cast
Okay I found the true culprit of my problems, the numbers were scanning in fine for those of you that were here before this edit. 好的,我找到了问题的真正根源,在此编辑之前,这些人的身影一直在扫描中。
void computeDataPoints(F_SELECT *fsPtr, int n, double points[][n])
{
int ix; // for indexing points, i.e. columns of 2D array
double x; // for incrementing the value of x
double inc; // incrementation value of x
inc = (fsPtr->xf - fsPtr->x0)/(n-1);
x= fsPtr->x0;
// Setup loop that computes the points and stores in 2D array
for (ix=0; ix<NUM_POINTS; ix = ix + 1)
{
points[X_IX][ix]=x;
points[FX_IX][ix]=calcFx(x, &fsPtr->fNumber);
x = x+ inc;
}
}
I have no Idea how to fix this and have done some searching, if anyone knows how to make this pass properly I'd love you forever 我不知道如何解决此问题,并做了一些搜索,如果有人知道如何正确通过此操作,我将永远爱你
I'm just guessing here since there is really to little go on, but I think the situation is this: 我只是在猜测,因为实际上很少进行任何操作,但是我认为情况是这样的:
You step through your code in your debugger. 您可以在调试器中逐步执行代码。 You stop at the call to scanf
, when the debugger cursor is on the scanf
line. 当调试器光标在scanf
行上时,您将停止在scanf
的调用上。 That means the call hasn't happened yet . 这表示呼叫尚未发生 。 You need to step one more time for the scanf
call to happen. 您需要再花一步时间使scanf
调用发生。
Another possibility is that you step past the scanf
call, and the debugger cursor is now on the function closing }
. 另一种可能是你踩过去scanf
调用,现在调试光标在函数结束}
。 Depending on the compiler and its generated code, that might mean that the variable sfPtr
has gone out of scope and can not be examined reliably by the debugger. 根据编译器及其生成的代码,这可能意味着变量sfPtr
已超出范围,并且无法由调试器可靠地检查。
The solution to both the above situation is to add another statement between the scanf
call and the end of the function. 解决上述两种情况的方法是在scanf
调用和函数结尾之间添加另一个语句。 For example a simple printf
call to print the values: 例如,一个简单的printf
调用来打印值:
...
// Select a range of x for plotting
printf("Select range of x for plotting (x0 and xf):");
scanf("%lf %lf", &sfPtr->x0, &sfPtr->xf);
// Print the values just entered
printf("x0 = %f, xf = %f\n", sfPtr->x0, sfPtr->xf);
// The function ends here
}
Besides printing the values, it also gives you an extra step in the debugger to check the values after the call to scanf
. 除了打印值之外,它还为您提供了调试器中的额外步骤,以在调用scanf
之后检查值。
I FOUND IT 我找到了
points[FX_IX][ix]=calcFx(x, &fsPtr->fNumber);
needs to be 需要是
points[FX_IX][ix]=calcFx(x, fsPtr->fNumber);
Thank you to everyone who tried to help me when I was looking in the wrong spot 谢谢所有在我找错地方时试图帮助我的人
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.