0

The short from CS50 is not giving me a clear idea about what an array is exactly. Can someone give me some more information about the array in C?

0

It's like a dresser.

When making the dresser, you need to tell the computer how many drawers the are.

You can reference these drawers because they are labeled, the first drawer being 0.

int array[5]; tells the computer to make a dresser with 5 drawers.

int element = array[2]; tells the computer to make a variable called element, and store in it whatever is in drawer #2 of the array, which is the 3rd drawer, because there was a drawer #0.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .