似乎无法理解C程序今仅存错误
我不知道如何解决和需要帮助的错误是:似乎无法理解C程序今仅存错误
在第20行和列28
[错误]不能转换 '诠释**' 到 'INT *' 的参数 '1' 到 '空隙 乐透(INT *,INT,INT,INT,INT,INT)'
在的这部分代码:
#include <stdio.h> #include <stdlib.h>
int read1();
int even1();
int even2();
int sum1();
int sum2();
void lotto(int*, int, int, int, int, int);
int* table_num(int);
int main()
{
int a=read1();
int* t = table_num(a);
int x=even1();
int y=even2();
int g=sum1();
int h=sum2();
lotto(&t, a, x, y, g, h); /*error here*/
return 0;
}
这里是功能:
void lotto(int* a, int n, int armax, int armin, int atmax, int atmin) {
int q, w, z=1;
for (int i = 0; i < n-5; ++i)
{
for (int j = i+1; j < n-4 ; ++j)
{
for (int k = j+1; k < n-3 ; ++k)
{
for (int l = k+1; l < n-2 ; ++l)
{
for (int m = l+1; m < n-1 ; ++m)
{
for (int i1 = m+1; i1 < n; ++i1)
{
q=0;
(i%2==0)?q+=1:2;
(j%2==0)?q+=1:2;
(k%2==0)?q+=1:2;
(l%2==0)?q+=1:2;
(m%2==0)?q+=1:2;
(i1%2==0)?q+=1:2;
w=i+j+k+l+m+i1;
if((q<=armax||q>=armin)&&(w>=atmin||w<=atmax))
{
printf("The %d st/nd/rd/th group of 6 numbers is :\t",z);
printf("%d ,%d ,%d ,%d ,%d ,%d \n\n",*(a+i), *(a+j), *(a+k), *(a+l), *(a+m), (a+i1));
z++;
}else
continue;
}
}
}
}
}
}
}
,如果你想需要整个代码回答我的问题,我可以在
回答:
编辑替换该lotto(&t, a, x, y, g, h);
到lotto(t, a, x, y, g, h);
在函数声明中,你提到输入参数为,指向int,bu t再次通过指向指向int的指针并且导致错误。
回答:
问题是'& t'在你指定'int *'的lotto()中并发送'int **'。尝试编译没有'&'
以上是 似乎无法理解C程序今仅存错误 的全部内容, 来源链接: utcz.com/qa/265367.html