QamoosTech
Programming FundamentalsData structuresBeginner

Array

Pronunciationuh-RAY

Definition

An ordered list of values. Each item has a position number called an index, which usually starts at 0.

Where you hear it

Any time you handle lists: users, products, results.

Examples

  • The API returns an array of users.
  • items[0] is the first element of the array.
  • Use push to add an item at the end of the array.

Common mistake

Forgetting that counting starts at 0, which causes off-by-one errors.

Don't confuse with

Array vs Linked List: An array stores elements in contiguous memory locations allowing fast access by index, whereas a linked list uses nodes with pointers for efficient insertions and deletions.

Say it at work

  • In a meeting or chatI think we should store these configuration flags in an array so we can iterate through them easily.
  • In an email or ticketPlease ensure the function returns an empty array instead of null if no results are found to avoid runtime errors.