|
|
|
#1 |
|
Messages: n/a
Hébergeur: |
what's the difference between vectors and arrays in C?
I only knew array, as data structure, and not vector! When must i use vector and when array? Thanks -- questo articolo e` stato inviato via web dal servizio gratuito http://www.newsland.it/news segnala gli abusi ad abuse@newsland.it |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
jacox said:
> what's the difference between vectors and arrays in C? Arrays exist. -- Richard Heathfield <http://www.cpax.org.uk> Email: -http://www. +rjh@ Google users: <http://www.cpax.org.uk/prg/writings/googly.php> "Usenet is a strange place" - dmr 29 July 1999 |
|
|
|
#3 |
|
Messages: n/a
Hébergeur: |
On 15 Apr, 09:27, jacopo...@yahoo.it (jacox) wrote:
> what's the difference between vectors and arrays in C? > I only knew array, as data structure, and not vector! > When must i use vector and when array? There are no "vectors" in C. There are in C++. Try a C++ news group if you are interested in the C++ answer. -- Nick Keighley |
|
|
|
#4 |
|
Messages: n/a
Hébergeur: |
> On Tue, 15 Apr 2008 08:33:11 +0000, Richard Heathfield wrote:
>> jacox said: >> what's the difference between vectors and arrays in C? > Arrays exist.M ![]() -- http://lispmachine.wordpress.com/ |
|
|
|
#5 |
|
Messages: n/a
Hébergeur: |
On 15 Apr 2008 at 8:27, jacox wrote:
> what's the difference between vectors and arrays in C? > I only knew array, as data structure, and not vector! > When must i use vector and when array? In C++, a vector is an array with some additional functionality. One of the main advantages is that vectors support bounds checking: if you use the at() method, the access will be bounds-checked and throw an exception if the element does not exist. (You can also avoid bounds checking by using [], which is overloaded.) A vector will also grow dynamically as needed when you add elements to it: an array's size is fixed once and for all when you define it. |
|
|
|
#6 |
|
Messages: n/a
Hébergeur: |
"jacox" <jacopoxxx@yahoo.it> wrote in message
news:fu1ot6$mdg$1@news.newsland.it... > what's the difference between vectors and arrays in C? In C++, there is a separate type of vector defined in the C++ standard. > I only knew array, as data structure, and not vector! "My foot was glued, like lead to the floor. That's all there is, and there ain't no more." -- "Hot Rod Lincoln" > When must i use vector and when array? In C, you just use arrays. ** Posted from http://www.teranews.com ** |
|
![]() |
| Outils de la discussion | |
|
|