Hi All
I'm using MS-VStudio 2005and want to creat two dimension array in the heap(free store )
but when i write the code
float *pFloat;
pFloat=new float[3][5];
and compile the profram i got the following error
error C2440: '=' : cannot convert from 'float (*)[5]' to 'float *'
1>Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
so could someone please tell me what's wrong in my code
|
Go4Expert Founder
|
![]() |
| 25May2007,18:28 | #2 |
|
You have posted it as an Article under the Article / Source code section. I have moved it to the Queries and Discussion forum. Please take care that you don't repeatedly post the query as an article.
|
|
Go4Expert Member
|
|
| 25May2007,18:47 | #3 |
|
Thanks and sorry
|
|
Team Leader
|
![]() |
| 25May2007,22:23 | #4 |
|
Code:
float (*pFloat)[5] = new float [3][5]; |
|
Go4Expert Member
|
|
| 27May2007,04:27 | #5 |
|
Thanks
i will try it and if i have any notes i will post it |
|
Go4Expert Member
|
|
| 29May2007,18:35 | #6 |
|
Please DaWei
when i tryed the code u suggested float (*pFloat)[5] = new float [3][5]; in my code i got this error error C2040: 'pFloat' : 'float (*)[5]' differs in levels of indirection from 'float *' So what's wrong do u have any suggestions[I] |
|
Go4Expert Member
|
|
| 30May2007,22:10 | #7 |
|
http://support.microsoft.com/kb/104639 should cover all the problems involved and the workarounds.
|
|
Team Leader
|
![]() |
| 31May2007,01:01 | #8 |
|
Works for me. Perhaps you have defined it otherwise, elsewhere.
|


