自己写了一个用来查看位图中直方图的函数.(m_pImgData为指向位图的数据块的指针).
void CPicViewView::OnLook() 
{
// TODO: Add your command handler code here
if(m_bmfh.bfType!=19778)
{
MessageBox("请加载图像!");
return ;
}
int ns_r[255];
int ns_g[255];
int ns_b[255];
for(int n1=0;n1<255;++n1)
{
ns_r[n1]=0;
ns_g[n1]=0;
ns_b[n1]=0;
}
     for(int j=0;j<m_bmih.biHeight-1;j++)
for(int i=0;i<m_bmih.biWidth*3;i++)

ns_r[m_pImgData[j][i]]++;//
i++;
ns_g[m_pImgData[j][i]]++;//
i++;
ns_b[m_pImgData[j][i]]++;//

}
  for(int i=0;i<=255;i++)
{
ns_r[i]=ns_r[i]/m_bmih.biSizeImage;
ns_g[i]=ns_g[i]/m_bmih.biSizeImage;
ns_b[i]=ns_b[i]/m_bmih.biSizeImage;
}
}
在//所在的行出现了如下的错误.
error C2109: subscript requires array or pointer type
error C2109: subscript requires array or pointer type
error C2109: subscript requires array or pointer type