Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [arrays]

For questions regarding the data storage structure of an Array. This can range from their standard indexing to their usage in comparison to other data structures. Arrays are an ordered list of elements which are usually all of the same type. Nested arrays can contain arrays as elements.

4
votes
5answers
281 views

What is a good teaching example/application for jagged arrays (2d arrays with irregular row lengths)?

We are teaching an AP CS class and the topic of 2d-arrays is coming up. There are plenty of cool and approachable sample applications for standard rectanglular arrays - matrix math, MIDI music, sudoku,...
-1
votes
1answer
88 views

Why does array index not start from -1 why have indexes to be positive? [closed]

Arrays start from 0 then 1,2... But why are indexes positive, why are indexes not negative?
169
votes
27answers
32k views

Why do we count starting from zero?

In computer science, we usually count starting from 0. Is there any effective way to explain why, to new programmers who ask why? I've read a bunch of different sources that list several reasons for ...
8
votes
6answers
418 views

Single-dimensional array and simple looping activities of significance

I give a lab on single-dimensional loops and arrays. By "single dimensional loops", I mean that there is no nesting of loops. (I will later give a second lab on multi-dimensional loops and arrays, ...
33
votes
13answers
3k views

Real life examples of 0-indexing

It can be perplexing for students to begin counting at 0 when they enter a CS class. I made it a point over and over to talk about "Day 0" and "Week 0" in the opening days and weeks just to build ...
10
votes
5answers
432 views

Lesson Idea: Arrays, Pointers, and Syntactic Sugar

One of the most challenging concepts to instill in new CS students is 0-indexing (indeed, the pedagogy of this fact probably merits its own discussion). Another difficult topic -- although a slightly ...
0
votes
2answers
102 views

What kind of game (in Scratch) would require use of a list? [closed]

I teach an introductory Scratch class to a group of elementary-school students. Most of the focus is on having fun creating simple games, but i still try to introduce a little higher-level programming ...