cplusplus
.com
TUTORIALS
REFERENCE
ARTICLES
FORUM
C++
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs
Forum
General C++ Programming
Setting dimensions of an array
Setting dimensions of an array
Mar 26, 2012 at 12:59am UTC
hopesfall
(179)
How could I initialize an array by a size given to me by the user? I need to be able to pass this array to a function that takes in
int
myArray[]
as a parameter so the way I tried, using vector, didn't work. Any suggestions?
Mar 26, 2012 at 1:48am UTC
hopesfall
(179)
Found the answer....
1
2
3
int
maxSize; cin << maxSize;
int
* arr =
new
int
[maxSize];
Topic archived. No new replies allowed.