| ||||||||||||||||||||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
c++: ptr to new multidimensional array?
Hey all,
Having a little difficulty, I'm trying to declare a new multidimensional array in c++ given some user input, but it's not coming out for me. What I have so far: #include <iostream> using std::cin; using std::cout; using std::endl; int main() { int s, n; int *i; cout<<"How many numbers: "; cin>>s; i = new int[s][20]; system("pause"); } The problem here is that I can get a one dimensional array, but when I enter the code above, I get a 'cannot convert 'int[*][20] to 'int**' in assignment, so I assume I have my syntax wrong. Anyone able to help? Much appreciated! |
|
#2
|
|||
|
|||
|
|
![]() |
| Viewing: Dev Articles Community Forums > Programming > C/C++ Help > c++: ptr to new multidimensional array? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|