cplusplus
.com
TUTORIALS
REFERENCE
ARTICLES
FORUM
C++
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs
Forum
Beginners
user generated array
user generated array
Feb 11, 2012 at 1:57am UTC
maharris
(85)
i'm wondering how to do a user generated array,
have a user enter a variable to enter array size, then i dont know how to have the user enter specific numbers for their generated array
Feb 11, 2012 at 1:59am UTC
MrHutch
(1822)
You can't dynamically size an array. The compiler needs to know the array size at compile time. Consider using vectors.
http://www.cplusplus.com/reference/stl/vector/
Last edited on
Feb 11, 2012 at 1:59am UTC
Feb 11, 2012 at 2:05am UTC
atropos
(184)
It is possible to dynamically allocate space for an array, but you have to use pointers,
new
, and
delete
[]
.
http://www.cplusplus.com/doc/tutorial/dynamic/
EDIT: here's the link to learn about arrays.
http://www.cplusplus.com/doc/tutorial/arrays/
Last edited on
Feb 11, 2012 at 2:06am UTC
Topic archived. No new replies allowed.