Help on array/vector initialization please 
Author Message
 Help on array/vector initialization please

Dear friends,

I have a program where I read some numbers from a data file and place
them in various vectors. I can find the size of the vectors by
rows=t.size() for example.  Now, I want to initialize some other vectors
or arrays that have the same size. How can I do that without knowing the
number of rows in advance?
In other words I cannot simply say double P[rows][1], because it is not
accepted.

Is there another way to do that?

And a related question: How can I find out the maximum number of
elements that can fit in an array or a matrix? Is there some kind of a
limit?

Thanks in advance,
Elias



Mon, 28 Feb 2005 02:48:33 GMT  
 Help on array/vector initialization please
vector<int> v(size);
v.resize(newSize);

See also vector::max_size()
--
With best wishes,
    Igor Tandetnik

"For every complex problem, there is a solution that is simple, neat,
and wrong." H.L. Mencken


Quote:
> Dear friends,

> I have a program where I read some numbers from a data file and place
> them in various vectors. I can find the size of the vectors by
> rows=t.size() for example.  Now, I want to initialize some other
vectors
> or arrays that have the same size. How can I do that without knowing
the
> number of rows in advance?
> In other words I cannot simply say double P[rows][1], because it is
not
> accepted.

> Is there another way to do that?

> And a related question: How can I find out the maximum number of
> elements that can fit in an array or a matrix? Is there some kind of a
> limit?

> Thanks in advance,
> Elias



Mon, 28 Feb 2005 02:51:55 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. NEED HELP WITH PRITING AN ARRAY, PLEASE PLEASE HELP

2. Please help!!!!Please help!!!!Please help!!!!Please help!!!!Please help!!!!Please help!!!!Please help!!!!

3. vector question when replacing array[10][20] with vectors

4. syntax help, structure and array initialization

5. Help: Initialization of an array of structure ?

6. DAO Initialization Errors, Please Help!

7. Using array index in array initialization list's

8. HELP Please Please (malloc on an array)

9. multidimensional vector initialization

10. Vector class help PLEASE!!!

11. vector initialization

12. Dynamic Array/Vector Data Structures HELP

 

 
Powered by phpBB® Forum Software