illegal for struct 请各位大神帮忙看下.
{int i = 0 , j = 0 , h = 0 , w = 0 , *gary_hist = NULL , scor = 0;
h = imgsrc->height;
w = imgsrc->width;
gary_hist = (int *)malloc(sizeof(int)*256);
memset(gary_hist , 0 , 256);
for(i = 0 ; i < h ; i++)
for(j = 0 ; j < w ; j++)
{
scor = imgsrc;
gary_hist = gary_hist + 1;
}
TST_SaveHist(gary_hist ,256 ,"garyhist.xls");
free(gary_hist);
}
这是一部分内容 运行的时候报错
1>f:\project\srccode\src_pre\src_bin\idc_bin.c(53) : error C2088: '[' : illegal for struct
各位大神帮忙看看.. {
int i = 0 , j = 0 , h = 0 , w = 0 , * gary_hist = NULL , scor = 0 ;
h = imgsrc->height ; // imgsrc 是个指向结构的指针
w = imgsrc->width ; // imgsrc 是个指向结构的指针
gary_hist = (int *)malloc(sizeof(int)*256) ;
memset(gary_hist , 0 , 256) ; // 应该改为:memset(gary_hist , 0 , sizeof(int) * 256) ;
for(i = 0 ; i < h ; i++) {
for(j = 0 ; j < w ; j++) {
scor = imgsrc ; // imgsrc 是二维整形数组?与前面冲突
gary_hist = gary_hist + 1 ;
}
}
TST_SaveHist(gary_hist ,256 ,"garyhist.xls") ;
free(gary_hist) ;
} jackz007 发表于 2019-3-18 17:56
对, 我for循环里面 imgsrc是个结构体,.谢谢大神了
页:
[1]