Y
Y
Yaroslav Nikitin2014-06-22 12:58:23
C++ / C#
Yaroslav Nikitin, 2014-06-22 12:58:23

Where can I find a book or part of it on working with arrays in C++?

Does anyone have a familiar book where it is written about working with arrays in C ++? At least the very base: deleting elements, adding elements, swapping and up to sorting. If it's in a book, write a chapter if you know. I don't trust articles. Looking forward to any options.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry, 2014-06-22
@copyloc

It looks like you have no understanding of "What is an array?". As a rule, programmers understand this as a sequence of homogeneous data of the same type.
* Data types, as you know, are different: int, float, long int, etc. Since C++ allows you to write in an object-oriented style, you can also use your own types, i.e. class objects from any libraries, for example from boost or written by yourself;
* The array has a size or such a terminator that you can rely on;
* An array can be traversed, i.e. move from one element to another until we get to the last element;
* Any element of the array can be randomly accessed. If you want to take the 5th element, then there is no problem if the size is greater than 5;
* The terminator can be organized in different ways, you can keep a byte counter in an external variable, indicating how many elements are in the array. Or you can rely on a specific value in the array that will mean that the array is complete, for example 0x0 (null-terminated array), there are other ways, but these are the most popular;
* To add to an array is simply to go to the last element and set the value of the element to be added + increase the value of the counter of elements in the array or change the position of the array terminator, move a little further;
* Remove from the array, which means you need to reduce the value of the counter of elements in the array or change the location of the array terminator;
For now, study this, and then if you are interested, then ask more. I will not clog my head right away, because There are still many problems when working with arrays, but you should not interfere with everything at once! Learn step by step
I forgot to say that you do not have to be attached to C ++, in pure C the same rules. For the sole reason that C++ was designed and developed to be compatible with C code.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question