关于动态数组
#include <iostream.h>
void install(int **p[][6]);
int main()
{
int **p;
p = new int*[2];
for(int a = 0;a < 2;a++)
{
p[a] = new int[6];
}
install(p);
for(int b = 0;b < 2;b++)
{
delete [][] *p;
}
delete [] p;
return 0;
}
void install(int **p[][6])
{
for(int c = 0;c < 2;c++)
{
for(int a = 0;a < 6;a++)
{
**p[c][a] = a+1;
}
}
for(int d = 0;d < 2;d++)
{
for(int b = 0;b < 6;b++)
{
cout<<**p[d][b]<<endl;
}
}
F:\debug\shiyan.cpp(11) : error C2664: 'install' : cannot convert parameter 1 from 'int ** ' to 'int **[][6] '
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
F:\debug\shiyan.cpp(14) : error C2059: syntax error : '['
F:\debug\shiyan.cpp(36) : fatal error C1004: unexpected end of file found
Error executing cl.exe.
shiyan.exe - 3 error(s), 0 warning(s)
报错信息真不知道怎么改了。。。