首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > C++ >

void指针有关问题,please

2012-04-05 
void指针问题,please!1 #include iostream2 using namespace std34 int main()5 {6int a[5]{0,1,2,3,4

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]的指针,谢谢了.

[解决办法]
因为楼主还不会写“指向数组的指针”造成的。请自己勤动手,多翻语法书。

热点排行