C++Talk.NET Forum Index C++Talk.NET
C++ language newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

multi-dimensional array dinamic allocation VERSUS <vector>

 
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ language (comp.lang.c++)
View previous topic :: View next topic  
Author Message
Roberto Dias
Guest





PostPosted: Tue Jun 29, 2004 5:06 pm    Post subject: multi-dimensional array dinamic allocation VERSUS <vector> Reply with quote



I'm a newbie in C++ programming. I bought a book yet and I have
learned by means internet donwloadble materials. I feel not
confortable using multi-dimensional arrays. I simply cannot understand
memory allocation principle. I have got some ideas that require this
one, but only thoughts and no action I have done. Unfortunately, the
Deitel book don't explore this topic well. Vectors? How to use them
insted of multi-dimensional arrays? What benefit do they bring to the
source code? Could you help me on this topics?

thanks,

Roberto Dias
Back to top
Paolo Alexis Falcone
Guest





PostPosted: Wed Jun 30, 2004 5:16 am    Post subject: Re: multi-dimensional array dinamic allocation VERSUS <vecto Reply with quote



Roberto Dias wrote:

Quote:
I'm a newbie in C++ programming. I bought a book yet and I have
learned by means internet donwloadble materials. I feel not
confortable using multi-dimensional arrays. I simply cannot understand
memory allocation principle. I have got some ideas that require this
one, but only thoughts and no action I have done. Unfortunately, the
Deitel book don't explore this topic well. Vectors? How to use them
insted of multi-dimensional arrays? What benefit do they bring to the
source code? Could you help me on this topics?

thanks,

Roberto Dias

C and C++ requires the programmer to manually manage memory allocation
issues (there's no automated garbage collection mechanism unlike in Java or
Python...). Case in point - if you're to use a list of objects that would
change its size on runtime you'd need to allocate memory for object
creation - then destroy them properly upon termination of the program -
else the memory allocated for the said data structure would not be freed. A
knowledge of how pointers work would be needed here.

Vectors are similar to arrays, except that the size of the container isn't
constrained by the declaration. Since it is a standard container class, the
properties of a vector can be manipulated by using the container algorithms
as defined in the STL.

Bjarne Stroustrup's "The C++ Programming Language" discusses much on C++
programming - and is imho a must-have for C++ programmers.
--


Paolo Alexis Falcone
[email]pfalcone (AT) free (DOT) net.ph[/email]

Back to top
Display posts from previous:   
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ language (comp.lang.c++) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.