473,386 Members | 1,743 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

multi-dimensional array dinamic allocation VERSUS <vector>

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
Jul 22 '05 #1
1 2358
Roberto Dias wrote:
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
pf******@free.net.ph
Jul 22 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

822
by: Turamnvia Suouriviaskimatta | last post by:
I 'm following various posting in "comp.lang.ada, comp.lang.c++ , comp.realtime, comp.software-eng" groups regarding selection of a programming language of C, C++ or Ada for safety critical...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.