Arrays are used to store two or more variables of the same type in contiguous memory. Since all elements are of the same type, they are also of the same size (in bytes), thus every element can be accessed as an offset from the start of the array. In an array of n elements, index 0 is the first element and index n-1 is the last element. By multiplying the index by the type size, the compiler can determine the start address of each element, thus permitting constant time, random access to any element within the array, as well as bi-directional traversal of the array.
Arrays provide the most compact method of storing multiple values of the same type. So long as you know the start address of the array (which is obtained by the array name alone) and the number of elements in the array (which must be stored separately), you can access any element in constant time.
C++ supports fixed-length arrays (std::array) and variable-length arrays (std::vector) as well as C-style arrays (both static and dynamic). In most cases you will use std::vector and std::array as they both provide bounds-checking, can be easily passed to functions by value, reference or pointer, and you enlist the compiler to ensure type safety. Both std::vector and std::array encapsulate the array, its type and its size, while std::vector uses a built-in memory manager to minimise reallocation of the array.
With C-style arrays, the onus is entirely upon the programmer to ensure bounds-checking and type safety are adhered to. In particular, passing a C-style array to a function via a pointer should be avoided as the function has no way to determine how many elements are actually in the array, let alone what type of elements were originally placed in the array.
7
No.
The size of a function can be determined from the size of the array. Arrays and functions are both used in computer programming.
It's actually not true. In order to make a good program which can work with big arrays you have to use dynamic arrays because you can cleam memory used by dymanic arrays any time. For static arrays is not true, memery which was reserved for static arrays will be available for other applications only when you finish working with your application (which is working with static arrays).
Arrays are not suitable for implementing queues because while they are ideal for adding to the end, the are not ideal for extraction from the beginning. For that you need a deque. Regardless, the STL (standard template library) already provides an efficient queue ADT in std::queue.
7
No.
No. Arrays can be defined at runtime, just as they can in C. It's just that it's generally more convenient to use vectors instead of dynamic arrays at runtime, thus arrays are generally used statically, at compile time.
Virtually every major application by Microsoft is developed using VC++, including Windows itself.
BAC (Bacterial Artificial Chromosome) arrays are a type of DNA arrays. BAC arrays are usually used for a technique called array CGH (Comparative Genomic Hybridisation) which is used to identify gross deletions or amplifications in DNA (which for example is common in cancer). DNA arrays include BAC arrays but also oligo, cDNA, and promoter arrays. Oligo and cDNA arrays are typically used for gene expression analysis (looking to see how heavily expressed each gene is). Oligo arrays can also be used for SNP (single nucleotide polymorphism) analysis. Promoter arrays are used to identify transcription factor binding sites.
Nothing whatsoever. They are exactly the same.
yes
Yes. All string variables are pointers as are other arrays.
The size of a function can be determined from the size of the array. Arrays and functions are both used in computer programming.
VC.
Let me correct you: two-dimensional arrays are used in programming to represent matrices. (Matrices are objects of mathematics, arrays are objects of programming.)
It's actually not true. In order to make a good program which can work with big arrays you have to use dynamic arrays because you can cleam memory used by dymanic arrays any time. For static arrays is not true, memery which was reserved for static arrays will be available for other applications only when you finish working with your application (which is working with static arrays).