就是简单的一个声明然后调用,然后编译器一直显示错误
#include
void copy_arr(double target1[],double source[],int a);
void copy_ptr(double target2[],double * source,int b);
void copy_ptrs(double target3[],double * source);
int main()
{
double source[5]={1.1, 2.2, 3.3, 4.4, 5.5};
double target1[5],target2[5],target3[5];
copy_arr(target1[5],source,5);
copy_ptr(target2[5],source,5);
copy_ptrs(target3[5],source);
}
void copy_arr(double target1[],double source[],int a)
{
int n;
for(n=0;n<5;n++)
{
target1[n]=source[n];
printf("target1[%d]=%lf ",n,target[n]);
}
printf("\n");
}
void copy_ptr(double target2[],double * source,int b)
{
int n;
for(n=0;n<5;n++)
{
target2[n]=*(source+n);
printf("target2[%d]=%lf ",n,target[n]);
}
printf("\n");
}
void copy_ptrs(double target3[],double * source)
{
int *point,n=0;
point=source;
while(point<source+5)
{
target3[n]=*point;
printf("target3[%d]=%lf ",n,target[n]);
point++;
n++;
}
printf("\n");
}
编译器主要是说impatible type for argument 1 of copy_arr等
还有就是说函数中的target没有声明,是第一次使用
感觉自己在这一块学的还行来着,不知道怎么一写出来出了好多问题。。。