0
Are vectors in c++ the same with arrays in java?
I dont know why its called "vectors" but it has the same functions as arrayd in java since they both must be declared with a data type and can only hold values with the same data type they are declared in
9 odpowiedzi
+ 3
Ipang,
No, an array cannot be resized dynamically in java. The size of the array is determined at the time of creation or initialization. It cannot be changed later.
+ 2
Vectors in C++ are sequence containers representing arrays that can change in size. They use contiguous storage locations for their elements, which means that their elements can also be accessed using offsets on regular pointers to its elements, and just as efficiently as in arrays
https://youtu.be/ryRf4Jh_YC0
+ 2
Can Java arrays resize (grow or shrink) themselves as necessary? C++ vectors can IIRC.
+ 2
Yes Martin,
That's right, I think it is too. I was just "asking" that to trigger the OP's mind to wonder (and research) whether (as it was asked) C++ vectors were similar to Java arrays.
+ 1
Simon Sauter why we can't up vote our own questions or posts??
Give me reason ...
there is nothing wrong upvoting your own posts
Mr Cat u can upvote your own post . there are no rules made for this . it's your own choice
0
HrCoder there are no rules against up voting one's own posts. That doesn't change the fact that it's pathetic. It's like writing a positive review for your own book.
- 3
Don't up vote your own posts, it's pathetic.