void指针问题,please!
1 #include <iostream>
2 using namespace std;
3
4 int main()
5 {
6 int a[5]={0,1,2,3,4};
7 void* p=&a;
8 cout<<sizeof(*(int* [5])p)<<endl;
9 }
t1.cc: In function ‘int main()’:
t1.cc:8: error: ISO C++ forbids casting to an array type ‘int* [5]’
请问void指针为何不能转换为int *[5]的指针,谢谢了.
[解决办法]
因为楼主还不会写“指向数组的指针”造成的。请自己勤动手,多翻语法书。