无法编译,类型冲突
程序代码:
#include<stdio.h> #define N 5 copy_arr(double source[],double target1[],int a); copy_ptr(double *source,double *target2,int b); int main(void) { double source[N]={1.1,2.2,3.3,4.4,5.5}; double target1[N]={0}; double target2[N]={0}; printf("2ù×÷Ç°:\n "); printf("source:\t%g\t%g\t%g\t%g\t%g\n",source[0],source[1],source[2],source[3],source[4]); printf("target1:\t%g\t%g\t%g\t%g\t%g\n",target1[0],target1[1],target1[2],target1[3],target1[4]); printf("target2:\t%g\t%g\t%g\t%g\t%g\n",target2[0],target2[1],target2[2],target2[3],target2[4]); copy_arr(source,target1,5); //copy_ptr(source,target2,5); printf("2ù×÷oó:\n"); printf("source :\t%g\t%g\t%g\t%g\t%g\n",source[0],source[1],source[2],source[3],source[4]); printf("target1:\t%g\t%g\t%g\t%g\t%g\n",target1[0],target1[1],target1[2],target1[3],target1[4]); printf("target2:\t%g\t%g\t%g\t%g\t%g\n",target2[0],target2[1],target2[2],target2[3],target2[4]); return 0; } void copy_arr(double source[],double target1[],int a) { int i; for(i=0;i<a;i++) { source[i]=target1[i]; } }