ineedhelpnow
- 649
- 0
whats an array for?...whats a vector for? what do they do? what purpose do they serve?
Last edited:
Arrays and vectors are fundamental data structures used to store collections of data. Arrays hold a fixed-size sequence of information indexed by natural numbers, while vectors, specifically referring to std::vector in C++, are dynamic arrays that allow for specialized operations such as addition and scalar multiplication. Arrays are predominantly utilized in graphics and gaming, but they also play a crucial role in various programming applications. Understanding the distinction between arrays and vectors is essential for effective coding and data management.
PREREQUISITESSoftware developers, computer science students, and anyone interested in understanding data structures and their applications in programming.
ineedhelpnow said:whats an array for?...whats a vector for? who do they do? what purpose do they serve?
ZaidAlyafey said:Arrays are a collection of data. It holds a sequence of information indexed using natural numbers. Vectors are like those in mathematics. They have specialized operations like adding , scalar-multiplication and so on.
Usually we use arrays and vectors to store data that share a certain property. For example , the students in a class , a finite subset of even numbers , list of books on a library. Most of the time , the size of an array is fixed once declared. Arrays , are mostly used in graphics and gaming.