简体   繁体   English

警告:传递'calcFx'的参数2将使指针产生整数而不进行强制转换

[英]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.

相关问题 警告:传递&#39;strcpy&#39;的参数1会使指针从整数开始而不进行强制转换 - warning: passing argument 1 of ‘strcpy’ makes pointer from integer without a cast 传递参数 1 从指针生成整数而没有强制转换警告 - Passing Argument 1 makes integer from pointer without a cast warning 传递参数 1 从指针生成 integer 而没有对 putchar 的强制转换警告 - Passing Argument 1 makes integer from pointer without a cast warning for putchar 警告:传递&#39;memcpy&#39;的参数1会使指针从整数开始而无需强制转换 - warning: passing argument 1 of ‘memcpy’ makes pointer from integer without a cast 警告传递&#39;finder&#39;的参数2使指针从整数开始而无需强制转换 - Warning passing argument 2 of 'finder' makes pointer from integer without a cast 警告:传递&#39;fopen&#39;的参数2会使指针从整数开始而无需强制转换 - warning: passing argument 2 of ‘fopen’ makes pointer from integer without a cast 警告:传递“ quicksort”的参数1会使指针从整数开始而无需强制转换 - warning: passing argument 1 of 'quicksort' makes pointer from integer without a cast c程序,&#39;fstat&#39;的警告消息传递参数1从没有强制转换的指针生成整数 - c program, warning message passing argument 1 of ‘fstat’ makes integer from pointer without a cast 警告:传递&#39;pthread_join&#39;的参数1将使指针产生整数,而没有强制转换错误 - warning: passing argument 1 of ‘pthread_join’ makes integer from pointer without a cast error 传递sprintf的参数2使指针从整数开始而无需强制转换。 C警告 - Passing argument 2 of sprintf makes pointer from integer without a cast. C warning
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM