Understanding Arrays & Vectors: What They Do & Why They Matter

  • Context: C/C++ 
  • Thread starter Thread starter ineedhelpnow
  • Start date Start date
  • Tags Tags
    Arrays Matter Vectors
Click For Summary

Discussion Overview

The discussion revolves around the concepts of arrays and vectors, exploring their definitions, purposes, and applications in programming. Participants express confusion about their usage and distinctions, particularly in coding contexts.

Discussion Character

  • Conceptual clarification, Debate/contested

Main Points Raised

  • Some participants define arrays as collections of data indexed by natural numbers and describe vectors as mathematical entities with operations like addition and scalar multiplication.
  • One participant suggests that arrays and vectors are used to store data sharing certain properties, providing examples such as students in a class or a list of books.
  • Another participant argues that arrays have broader applications beyond graphics and gaming, stating that most nontrivial programs utilize arrays in some form.
  • A participant expresses confusion regarding the terminology, noting that std::vector is a type-safe dynamic array, which they find misleading due to the use of the term "vector."
  • One participant shares a recollection of a class discussion where it was mentioned that arrays are not actually used in coding, which contributed to their confusion.

Areas of Agreement / Disagreement

Participants express varying definitions and understandings of arrays and vectors, indicating that there is no consensus on their usage and significance in programming.

Contextual Notes

Some definitions and examples provided may depend on specific programming languages or contexts, and there is uncertainty regarding the practical use of arrays in coding.

ineedhelpnow
Messages
649
Reaction score
0
whats an array for?...whats a vector for? what do they do? what purpose do they serve?
 
Last edited:
Technology news on Phys.org
ineedhelpnow said:
whats an array for?...whats a vector for? who do they do? what purpose do they serve?

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.
 
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.

I would say arrays have more uses than outside graphics and gaming. Most nontrivial programs feature arrays in some way. Arrays and key-value stores (dictionaries/maps) are the most basic data structures.

Also, I think NHN is talking about std::vector, not an actual 3D vector (std::vector is just a type-safe dynamic array). I seriously hate that it's called a "vector" and not an array or list, it's really confusing (even more confusingly, there is an std::list, but it's implemented as a linked list, and hence not usually worth using).
 
A vector is an ordered list of items of a given data type.
this is what i have as a definition but i still don't really get it.
 
i remember he said in class that we don't ACTUALLY use arrays when we code or something like that. and that got me very confused. he didn't explain it. he just mentioned something about not using them when coding and then he cut off.
 

Similar threads

  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 20 ·
Replies
20
Views
3K
  • · Replies 4 ·
Replies
4
Views
6K
  • · Replies 6 ·
Replies
6
Views
4K
  • · Replies 31 ·
2
Replies
31
Views
3K
Replies
6
Views
3K
  • · Replies 17 ·
Replies
17
Views
3K
Replies
20
Views
2K
  • · Replies 10 ·
Replies
10
Views
2K
  • · Replies 13 ·
Replies
13
Views
5K