一个例题有错误提醒,但找不出
//指向数组的指针作函数参数#include<stdio.h>
void main()
{
void search(float*,int);
float a[3][4]={{65,67,70,60},{80,87,90,81},{90,99,100,98}};
search(a,1);
}
void search(float *x,int n)
{
int i;
for(i=0;i<4;i++)
{printf("%f",*(*(x+n)+i));}
}
提示如下错误:
Compiling...
zxszzz.cpp
C:\Documents and Settings\Administrator\桌面\zxszzz.cpp(7) : error C2664: 'search' : cannot convert parameter 1 from 'float [3][4]' to 'float *'
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
C:\Documents and Settings\Administrator\桌面\zxszzz.cpp(13) : error C2100: illegal indirection
Error executing cl.exe.
对比了别人的程序,好像没什么区别,望高手指点