首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > C语言 >

看看程序,有关问题出那里了 declaration syntax error 小弟我的系统TC2.0

2012-03-14 
看看程序,问题出那里了 declaration syntax error我的系统TC2.0/*分别利用数组名和指针作形参,进行数据拷

看看程序,问题出那里了 declaration syntax error 我的系统TC2.0
/*分别利用数组名和指针作形参,进行数据拷贝*/
#include   <stdio.h>
#define   SIZE   5
void   copy_arr(double   [],   double   [],   int);       /*数组名作形参*/    
void   copy_ptr(double   *,   double   *,   int);           /*指针作形参*/
int   main(void)
{
        int   i   ;
        double   source[SIZE]   =   {1.1,   2.2,   3.3,   4.4,   5.5}   ;     /*定义3个数组*/
        double   target1[SIZE]   ;
        double   target2[SIZE]   ;
        copy_arr(source,target1,SIZE);     /*调用函数*/
        copy_ptr(source,target2,SIZE);
        for(i   =   0;i   <   SIZE;i++)           /*打印数组*/
              {
  printf( "target1[%d]=%2.2lf   target2[%d]=%2.2lf\n ",i,target1[i],i,target2[i])   ;
              }
        return   0;
}

void   copy_arr(double   source[],double   target1[],int   SIZE)      
{
        int   i   ;
        for(i   =   0;i   <   SIZE;i++)
              {
  target1[i]   =   source[i]   ;
              }
}

void   copy_ptr(double   *pts,double   *ptr,int   SIZE)
{
        int   i   ;
        for(i   =   0;i   <   SIZE;i++)
              {
    *(ptr+i)   =   *(pts+i)   ;
              }
}

[解决办法]
void copy_arr(double source[],double target1[],int SIZE)
void copy_ptr(double *pts,double *ptr,int SIZE)

-------------------------------------------
SIZE是个宏 改一下 size
[解决办法]
void copy_arr(double source[],double target1[],int SIZE)
void copy_ptr(double *pts,double *ptr,int SIZE)
==============================================
命名存在冲突
将函数参数里的SIZE改名,并在代码里将SIZE修改即可
[解决办法]
先占个座再看``

热点排行