DarkSoldier
Gawd
- Joined
- Jul 8, 2001
- Messages
- 610
Why is this declaration:
okay, but this one:
spits up this:
C:\Program Files\Microsoft Visual Studio\MyProjects\dfs\main.cpp(7) : error C2440: 'initializing' : cannot convert from 'const int' to 'int *'
Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast
C:\Program Files\Microsoft Visual Studio\MyProjects\dfs\main.cpp(7) : error C2440: 'initializing' : cannot convert from 'const int' to 'int *'
Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast
C:\Program Files\Microsoft Visual Studio\MyProjects\dfs\main.cpp(7) : error C2440: 'initializing' : cannot convert from 'const int' to 'int *'
Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast
Error executing cl.exe.
I'm more curious actually why the char example works than I am with why the int version doesn't. Can anyone explain to me what the difference is between these two cases?
Code:
char* text = "text" ;
okay, but this one:
Code:
int* numbers = {1,2,3} ;
spits up this:
C:\Program Files\Microsoft Visual Studio\MyProjects\dfs\main.cpp(7) : error C2440: 'initializing' : cannot convert from 'const int' to 'int *'
Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast
C:\Program Files\Microsoft Visual Studio\MyProjects\dfs\main.cpp(7) : error C2440: 'initializing' : cannot convert from 'const int' to 'int *'
Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast
C:\Program Files\Microsoft Visual Studio\MyProjects\dfs\main.cpp(7) : error C2440: 'initializing' : cannot convert from 'const int' to 'int *'
Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast
Error executing cl.exe.
I'm more curious actually why the char example works than I am with why the int version doesn't. Can anyone explain to me what the difference is between these two cases?