Code:
#include<stdio.h>
void copy1(float a[],float b[],int c);
void copy2(float *d,float *c,int a);
int main(void)
{
int a;
float *b;
static float rain[12]=
{10.2,8.1,6.8,4.2,1.5,2.6,2.6,6.4,5.8,4.5,1.1,5.9};
static float copy1[12]=
{0,0,0,0,0,0,0,0,0,0,0,0};
static float copy2[12]=
{0,0,0,0,0,0,0,0,0,0,0,0};
copy1(rain,copy1,6);
copy2(rain,copy2,5);
b=copy1;
for (a=0;a<12;a++)
printf("%4.1f",*(b+a));
system("pause");
return 0;
}
void copy1(float a[],float b[],int c)
{
int d;
for (d=0;d<c;d++)
b[d]=a[d];
}
void copy2(float *d,float *c,int a)
{
int b;
for (b=0;b<a;b++)
(c+b)=*(d+b);
}
after I called the copy1 and copy2 function, there was a error saying"called object is not a function", how can this happen? and the last assignment (c+b)=*(d+b); is invalid, why?