0
Can you declare an array with no size?
i have an idea on how to implement an array in my hailstone program, but I would like to declare it first as a function prototype before giving it a size. The size will be based on how many times the hailstone sequence runs. Any help would be much appreciated. v/r Sherwin Slaughter
4 odpowiedzi
+ 2
In C++ include <vector> or <list>. It allow you to create dynamic, resizable "array". Details are availible on C++ references.
If you know exact size of array in some moment you'll can simply declare:
int *array = new int[size];
When array won't be needed anymore you can clear memory:
delete [] array;
+ 1
var[] Array_name;
That should do the trick
0
@Aaron,
Thank you.
0
@Adam Emieljaniuk,
I'll look into the C++ references as well. Thank you.